System and method for training a detection model using machine learning

ABSTRACT

Disclosed herein are methods and systems for detecting malicious files. An exemplary method comprises: selecting a file from a database of files used to perform training of a model for detecting a malicious file, forming one or more behavior patterns from intercepted one or more commands and parameters during execution of the file, forming a detection model, wherein the detection model selects a method of machine learning and is initialized with one or more hyper-parameters, training the detection model by calculating the one or more hyper-parameters based on the one or more behavior patterns to form a group of rules for calculating a degree of maliciousness of a resource and calculating a degree of maliciousness of another file based on the trained detection model.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims the benefit of priority under 35 U.S.C.119(a)-(d) of Russian Application No. 2018147233 filed on Dec. 28, 2018,the contents of which are incorporated in their entirety herein.

FIELD

The present disclosure relates to antivirus technologies and, moreparticularly to systems and methods for detection of malicious files.

BACKGROUND

The rapid growth of computer technologies in the last decade, and alsothe widespread use of various computing devices (personal computers,notebooks, tablets, smartphones, and so on), have become a powerfulstimulus for the use of those devices in diverse areas of activity andfor a huge number of tasks (from Internet surfing to bank transfers andelectronic document traffic). In parallel with the growth in the numberof computing devices and the volume of software running on thesedevices, the number of malicious programs has also grown at a rapidpace.

A huge number of varieties of malicious programs exists at present. Someof them steal personal and confidential data from the devices of users(such as logins and passwords, bank details, electronic documents).Others form so-called botnets from the devices of users for attacks suchas a DDoS (Distributed Denial of Service) or for sorting throughpasswords by the method of brute force against other computers orcomputer networks. Still others propose paid content to users throughintrusive advertising, paid subscriptions, sending of SMS to tollnumbers, and so forth.

Special programs known as antiviruses deal are used to combat maliciousprograms, including the detecting of malicious programs, the preventingof infection, and the restoring of the working capacity of the computingdevices infected with malicious programs. Antivirus programs employvarious technologies to detect the full variety of malicious programs,such as:

-   -   static analysis—the analysis of programs for maliciousness,        excluding the launching or emulating of the working of the        programs being analyzed, on the basis of the data contained in        the files making up the programs being analyzed, wherein it is        possible to use during statistical analysis:        -   signature analysis—the search for correspondences of a            particular segment of code of the programs being analyzed to            a known code (signature) from a database of signatures of            malicious programs;        -   white and black lists—the search for calculated check sums            from the programs being analyzed (or portions thereof) in a            database of check sums of malicious programs (black lists)            or a database of check sums of safe programs (white lists);    -   dynamic analysis—the analysis of programs for maliciousness on        the basis of data obtained in the course of execution or        emulation of the working of the programs being analyzed, wherein        it is possible to use during dynamic analysis:        -   heuristic analysis—the emulation of the working of the            programs being analyzed, the creating of emulation logs            (containing data on the calls of API functions, the            parameters transmitted, the code segments of the programs            being analyzed, and so on) and the search for            correspondences between the data of the logs created and the            data from a database of behavioral signatures of malicious            programs;        -   proactive protection—the intercepting of calls of API            functions of the launched programs being analyzed, the            creating of logs of the behavior of the programs being            analyzed (containing data on the calls of API functions, the            parameters transmitted, the code segments of the programs            being analyzed, and so on) and the search for            correspondences between the data of the logs created and the            data from a database of calls of malicious programs.

Both static and dynamic analysis have their pluses and minuses. Staticanalysis is less demanding on the resources of the computing device onwhich the analysis is being done, and since it does not require theexecution or the emulation of the program being analyzed, statisticalanalysis is faster, but at the same time less effective, i.e. it has alower percentage of detection of malicious programs and a higherpercentage of false alarms (i.e. making a decision that a file analyzedby the means of the antivirus program is malicious, when the analyzedfile is safe). Dynamic analysis, since it uses data obtained during theexecution or emulation of the working of the program being analyzed, isslower and makes higher demands on the resources of the computing deviceon which the analysis is being performed, but at the same time it isalso more effective. Modern antivirus programs employ a comprehensiveanalysis, including elements of both static and dynamic analysis.

Since modern standards of information security require an operativeresponse to malicious programs (especially to new ones), automatic meansof detection of malicious programs are the main focus of attention. Forthe effective operation of such means, elements of artificialintelligence and various methods of machine learning by models for thedetection of malicious programs (i.e. sets of rules for decision makingas to the maliciousness of a file on the basis of a certain set of inputdata describing the malicious file) are often used, enabling effectivedetection of not only well known malicious programs or maliciousprograms with well-known malicious behavior, but also new maliciousprograms having unknown or little studied malicious behavior, as well asoperative adaptation (learning) to detect new malicious programs.

Although known technologies deal well with the detection of maliciousfiles having certain characteristic attributes (i.e. data describingcertain features of files from a certain group of files, such as thepresence of a graphic interface, data encryption, data transmissionthrough a computer network, and so on) similar to the characteristicfeatures of already known malicious files, they are unable to deal withthe detection of malicious files having characteristic featuresdifferent from the characteristic features of already known maliciousfiles (albeit similar behavior), and furthermore the above-describedtechnology does not disclose such aspects of machine learning by modelsas testing and retraining of models, as well as forming and reforming ofthe characteristic features (depending on the results of theaforementioned testing).

The present disclosure makes it possible to solve the problem ofdetecting malicious files.

SUMMARY

The present disclosure is designed for the antivirus scanning of files.

One of the many exemplary technical results of the present disclosureconsists in increasing the quality of scanning of a file formaliciousness.

Yet another exemplary technical result of the present disclosureconsists in reducing the computing resources used in performing thescanning of a file for maliciousness.

These results are accomplished with the aid of a method, system andcomputer program product for detecting a malicious file.

An exemplary method comprises selecting a file from a database of filesused to perform training of a model for detecting a malicious file,forming one or more behavior patterns from intercepted one or morecommands and parameters during execution of the file, forming adetection model, wherein the detection model selects a method of machinelearning and is initialized with one or more hyper-parameters, trainingthe detection model by calculating the one or more hyper-parametersbased on the one or more behavior patterns to form a group of rules forcalculating a degree of maliciousness of a resource and calculating adegree of maliciousness of another file based on the trained detectionmodel.

In one aspect of the method, the selecting the file from the database offiles used to perform training of the model is based on predeterminedrules of forming a training selection of files.

In one aspect of the method, the database of files is a database of safefiles comprising one or more of operating system files, backdoor files,applications carrying out unauthorized data access.

In one aspect of the method, the distribution between safe and maliciousfiles selected from the database of files corresponds to thedistribution between safe and malicious files located on the computingdevice of the average user.

In one aspect of the method, the distribution between safe and maliciousfiles selected from the database of files corresponds to thedistribution between safe and malicious files collected with the help ofantivirus web crawlers.

In one aspect of the method, at least one of the parameters of the filesselected from the database of files correspond to the parameters of thefiles located on the computing device of the average user or the numberof selected files corresponds to a predetermined value, while the filesthemselves are selected at random.

In one aspect of the method, training further comprises: selecting atleast one more file from the database of files in accordance withpredetermined rules of forming a test selection of files, verifying thetrained detection model on the basis of an analysis of the selectedfiles and sending the selected files to form a behavior log.

In one aspect, the method further comprises: intercepting executablecommands, determining parameters associated with each of the executablecommands that were intercepted, forming the behavior log based on theparameters.

In one aspect of the method, intercepting is performed using one of aspecialized driver, a debugger and a hypervisor.

In one aspect of the method, the method for machine learning is selectedbased on one or more of cross testing, sliding check, cross-validation,mathematical validation, A/B testing, split testing and stacking.

In one aspect, the method further comprises creating the detection modelon demand based on machine learning, wherein the hyper parameters andmethods of machine learning are selected to be different from the hyperparameters and machine learning methods chosen for a previous detectionmodel.

In one aspect of the method, the method for machine learning is selectedto ensure a monotonic change in the degree of maliciousness of a filedepending on the change in the number of behavior patterns formed on thebasis of analysis of a behavior log.

In other aspects of the disclosure, a system is provided to carry outthe methods described herein.

In yet other aspects, instructions for carrying out the methodsdescribed herein may be stored on a non-transitory computer-readablemedium.

The above simplified summary of example aspects of the disclosure servesto provide a basic understanding of the disclosure. This summary is notan extensive overview of all contemplated aspects, and is intended toneither identify key or critical elements of all aspects nor delineatethe scope of any or all aspects of the disclosure. To the accomplishmentof the foregoing, the one or more aspects of the disclosure include thefeatures described and particularly pointed out in the claims.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated into and constitute apart of this specification, illustrate one or more example aspects ofthe present disclosure and, together with the detailed description,serve to explain their principles and implementations.

FIG. 1 shows the structural diagram of the system for machine learningby a model for detection of malicious files, in accordance withexemplary aspects of the present disclosure.

FIG. 2 shows the structural diagram of the method for machine learningby a model for detection of malicious files, in accordance withexemplary aspects of the present disclosure.

FIG. 3 shows examples of the dynamics of change in the degree ofmaliciousness as a function of the number of behavior patterns, inaccordance with exemplary aspects of the present disclosure.

FIG. 4 shows an example of the diagram of relations between elements ofbehavior patterns, in accordance with exemplary aspects of the presentdisclosure.

FIG. 5 shows the structural diagram of the system for detection ofmalicious files using a trained model for detection of malicious files,in accordance with exemplary aspects of the present disclosure.

FIG. 6 shows the structural diagram of the method for detection ofmalicious files using a trained model for detection of malicious files,in accordance with exemplary aspects of the present disclosure.

FIG. 7 shows the structural diagram of the method for detection of amalicious file, in accordance with exemplary aspects of the presentdisclosure.

FIG. 8 shows the structural diagram of the method for detection of amalicious file, in accordance with exemplary aspects of the presentdisclosure.

FIG. 9 shows examples of the dynamics of change in the degree ofmaliciousness and the limit degree of safety as a function of the numberof behavior patterns, in accordance with exemplary aspects of thepresent disclosure.

FIG. 10 shows an example of a general-purpose computer system, apersonal computer or a server, in accordance with exemplary aspects ofthe present disclosure.

DETAILED DESCRIPTION

Exemplary aspects are described herein in the context of a system,method, and computer program product for the antivirus scanning offiles. Those of ordinary skill in the art will realize that thefollowing description is illustrative only and is not intended to be inany way limiting. Other aspects will readily suggest themselves to thoseskilled in the art having the benefit of this disclosure. Reference willnow be made in detail to implementations of the example aspects asillustrated in the accompanying drawings. The same reference indicatorswill be used to the extent possible throughout the drawings and thefollowing description to refer to the same or like items.

The following definitions and concepts are used throughout thedescription of variant aspects of the present disclosure.

Malicious file—a file of which the execution is known to be able toresult in unauthorized destruction, blocking, modification, copying ofcomputer information or neutralization of the methods of protection ofcomputer information.

Malicious behavior of a file being executed—a group of actions which maybe performed during execution of that file and which are known to beable to result in unauthorized destruction, blocking, modification,copying of computer information or neutralization of the methods ofprotection of computer information.

Malicious activity of a file being executed—a group of actions performedby that file in accordance with its malicious behavior.

Computing device of the average user—a hypothetical (theoretical)computing device having averaged characteristics of the computingdevices of a group of users selected in advance on which the sameapplications are executed as on the computing devices of those users.

Command executable by a computing device—a set of machine instructionsor instructions of scripts executable by a computing device on the basisof the parameters of those instructions, known as command parameters orparameters describing said command.

Lexical analysis (tokenizing)—a process of analytical parsing of aninput sequence of characters into recognized groups (hereafter:lexemes), in order to form at the output identification sequences(hereafter: tokens).

Token—an identification sequence formed from a lexeme in the process oflexical analysis.

FIG. 1 shows the structural diagram of the system for machine learningby a model for detection of malicious files.

The structural diagram of the system for machine learning consists of atraining selections preparation module 111, a behavior log formingmodule 112, a behavior pattern forming module 121, a convolutionfunction forming module 122, a detection model creation module 131, adetection model machine learning module 132, a degree of maliciousnesscalculation module 142, and a resource management module 143.

In one variant aspect of the system, the aforementioned system ofmachine learning by the model for detection is a client-serverarchitecture, in which the training selections preparation module 111,the behavior log forming module 112, the behavior pattern forming module121, the convolution function forming module 122, the detection modelcreation module 131, and the detection model machine learning module 132work at the server side, and the behavior pattern forming module 121,the degree of maliciousness calculation module 142 and the resourcemanagement module 143 work on the client side.

For example, the client may be the computing devices of a user, such aspersonal computer, notebook, smartphone, and so forth, and the servermay be the computing devices of an antivirus company, such asdistributed systems of servers by means of which, besides everythingelse, a preliminary collection and antivirus analysis of files, acreation of antivirus records, and so forth, will be performed, whereinthe system of machine learning by a model for detection of maliciousfiles will be used to detect malicious files at the client side, therebyenhancing the effectiveness of the antivirus protection of that client.

In yet another example, both the client and the server may be thecomputing devices of the antivirus company alone, wherein the system ofmachine learning by the model for detection of malicious files will beused for an automated antivirus analysis of files and creation ofantivirus records, thereby enhancing the working effectiveness of theantivirus company.

The training selections preparation module 111 is designed to:

-   -   select at least one file from a database of safe files in        accordance with predetermined rules of forming a training        selection of files, after which the detection model machine        learning module 132 will carry out the training of the detection        model on the basis of an analysis of the selected files;    -   send the selected files to the behavior log forming module 112.

In one variant aspect of the system, at least one safe file and onemalicious file are kept in the database of files.

For example, in the database of safe files may be the files of theWindows operating system, and malicious files may be the files ofbackdoors, applications carrying out unauthorized access to data and toremote control of an operating system and a computer as a whole.Furthermore, the model for detection of malicious files trained on theaforementioned files using methods of machine learning will be able todetect malicious files having a functionality similar to thefunctionality of the aforementioned backdoors with high accuracy (themore files were used for the training of the aforementioned model fordetection the higher the accuracy).

In yet another variant aspect of the system, at least:

-   -   suspicious files (riskware)—files which are not malicious, yet        are able to carry out malicious actions;    -   unknown files—files of which the maliciousness has not been        determined and remains unknown (i.e. files which are not safe,        malicious, suspicious, and so forth) are additionally kept in        the database of files.

For example, in the database of files suspicious files may be the filesof applications for remote administration (such as RAdmin), archiving,or data encryption (such as WinZip), and so on.

In yet another variant aspect of the system, at least files:

-   -   collected by antivirus web crawlers;    -   sent in by users    -   are kept in the database of files.

Furthermore, the aforementioned files are analyzed by antivirus experts,including with the help of automatic methods of file analysis, in orderto then make a decision as to the maliciousness of said files.

For example, files sent in by users from their computing devices to theantivirus companies for checking of their maliciousness may be kept inthe database of files, in which case the files sent in may be eithersafe or malicious, and the distribution between the number of said safeand malicious files is close to the distribution between the number ofall safe and malicious files located on the computing devices of saidusers (i.e. the ratio of the number of said safe files to the number ofsaid malicious files differs from the ratio of the number of all safefiles to the number of all malicious files located on the computingdevices of said users by a quantity less than a specified thresholdvalue

$\left. {{{\frac{N_{clean}}{N_{malware}} - \frac{\forall N_{clean}}{\forall N_{malware}}}} < ɛ} \right).$

Unlike the files sent in by users (i.e. files which are subjectivelysuspicious), the files collected by antivirus web crawlers which aredesigned to search for suspicious and malicious files more often thannot prove to be malicious.

In yet another variant aspect of the system, at least one of thefollowing conditions is used as the criteria for selecting files fromthe database of files:

-   -   the distribution between safe and malicious files selected from        the database of files corresponds to the distribution between        safe and malicious files located on the computing device of the        average user;    -   the distribution between safe and malicious files selected from        the database of files corresponds to the distribution between        safe and malicious files collected with the help of antivirus        web crawlers;    -   the parameters of the files selected from the database of files        correspond to the parameters of the files located on the        computing device of the average user;    -   the number of selected files corresponds to a predetermined        value, while the files themselves are selected at random.

For example, the database of files contains 100 000 files, among which40% are safe files and 60% are malicious files. From the database offiles 15 000 files (15% of the total number of files being kept in thedatabase of files) are chosen such that the distribution between theselected safe and malicious files corresponds to the distributionbetween the safe and the malicious files located on the computing deviceof the average user and amounts to 95 to 5. For this purpose, 14 250safe files (35.63% of the total number of safe files) and 750 maliciousfiles (1.25% of the total number of malicious files) are chosen atrandom from the database of files.

In yet another example, the database of files contains 1 250 000 files,of which 95% are safe files and 5% are malicious files, i.e. thedistribution between the safe and malicious files being kept in thedatabase of files corresponds to the distribution between the safe andthe malicious files located on the computing device of the average user.Of these files, 5000 files are chosen at random, of which with a highprobability ^(˜)4750 prove to be safe files and ^(˜)250 malicious files.

In yet another variant aspect of the system, the file parameters are atleast:

-   -   the maliciousness of the file, characterizing whether the file        is safe, malicious, potentially dangerous, or the behavior of        the computer system when executing the file is not determined,        and so forth;    -   the number of commands performed by the computing device during        the execution of the file;    -   the size of the file;    -   the applications utilizing the file.

For example, malicious files are chosen from the database of files whichare scripts in the “ActionScript” language, executable by theapplication “Adobe Flash”, and not exceeding 5 kb in size.

In yet another variant aspect of the system, the training selectionspreparation module 111 is additionally designed to:

-   -   select at least one more file from the database of files in        accordance with predetermined rules of forming a test selection        of files, and after this the detection model machine learning        module 132 will carry out a verification of the trained        detection model on the basis of an analysis of the selected        files;    -   send the selected files to the behavior log forming module 112.

For example, the database of files contains 75 000 files, among which20% are safe files and 80% are malicious files. First of all, 12 500files are chosen from the database of files, of which 30% are safe filesand 70% are malicious files, and after this the detection model machinelearning module 132 will perform the training of the detection model onthe basis of an analysis of the selected files, and then 2500 files areselected from the remaining 62 500 files, of which 60% are safe filesand 40% are malicious files, and after this the detection model machinelearning module 132 will perform a check of the trained detection modelon the basis of an analysis of the selected files. The data formulatedin the above-described way is called the cross-validation set of data.

The behavior log forming module 112 is designed to:

-   -   intercept at least one executable command at least during:        -   the execution of the file received,        -   the emulation of the execution of the file received, wherein            the emulation of the execution of the file includes the            opening of that file (for example, the opening of a script            by an interpreter);    -   determine for each intercepted command at least one parameter        describing that command;    -   form the behavior log of the file received on the basis of the        intercepted commands and the parameters so determined, wherein        the behavior log constitutes the totality of intercepted        commands (hereinafter, the command) from the file, where each        command corresponds to at least one parameter so determined and        describing that command (hereinafter, the parameter).

For example, the commands intercepted during the execution of amalicious file which collects passwords and transmits them via acomputer network and the parameters calculated for said commands maylook like:

-   -   CreateFile, ‘c:\windows\system32\data.pass’    -   ReadFile, 0x14ea25f7, 0xf000    -   connect, http://stealpass.com    -   send, 0x14ea25f7, 0xf000

In one variant aspect of the system, the intercepting of commands fromthe file is carried out with the aid of at least:

-   -   a specialized driver;    -   a debugger;    -   a hypervisor.

For example, the intercepting of commands during the execution of thefile and the determination of their parameters is carried out with theaid of a driver which utilizes an interception by splicing of the entrypoint of a WinAPI function.

In yet another example, the intercepting of commands during theemulation of the working of a file is carried out directly by theemulator means which performs said emulation and determines theparameters of the command needing to be emulated.

In yet another example, the intercepting of commands during theexecution of the file on a virtual machine is carried out by thehypervisor, which determines the parameters of the command needing to beemulated.

In yet another variant aspect of the system, the intercepted commandsfrom the file are at least:

-   -   API functions;    -   sets of machine instructions describing a predetermined set of        actions (macro commands).

For example, malicious programs very often perform a search for certainfiles and modify their attributes, for which a sequence of commands isexecuted, such as:

FindFirstFile, ‘c:\windows\system32\*.pass’, 0x40afb86a

-   -   SetFileAttributes, ‘c:\windows\system32\data.pass’    -   FindNextFile, 0x40afb86a    -   CloseHandle, 0x40afb86a,        which may in turn be described by only a single command    -   _change_attributes, ‘c:\windows\system32\*.pass’

In yet another variant aspect of the system, each command is matched upwith its unique identifier.

For example, all WinAPI functions may be matched up with numbers in therange of 0x0000 to 0x8000, where each WinAPI function corresponds to itsunique number (for example, ReadFile→0x00f0, ReadFileEx→0x00f1,connect→0x03A2).

In yet another variant aspect of the system, several commands describingsimilar actions are matched up with a single identifier.

For example, all commands such as ReadFile, ReadFileEx, ifstream,getline, getchar and so forth, which describe a reading of data from afile, are matched up with an identifier _read_data_file (0x70F0).

The behavior pattern forming module 121 is designed to:

-   -   form at least one behavior pattern on the basis of the commands        and parameters selected from the behavior log, wherein the        behavior log constitutes the totality of executable commands        (hereinafter, the command) from the file, where each command        corresponds to at least one parameter describing that command        (hereinafter, the parameter), and the behavior pattern is a set        of at least one command and a parameter which describes all of        the commands of that set (hereinafter, the elements of the        behavior pattern);    -   send the behavior patterns so formed to the convolution function        forming module 122;

For example, from the behavior log the following commands c_(i) andparameters p_(i) are selected:

-   -   {c₁, p₁, p₂, p₃},    -   {c₂, p₁, p₄},    -   {c₃, p₅},    -   {c₂, p₅},    -   {c₁, p₅, p₆},    -   {c₃, p₂}.

On the basis of the selected commands and parameters, behavior patternsare formed each containing one command and one parameter describing thatcommand:

-   -   {c₁, p₁}, {c₁, p₂}, {c₁, p₃}, {c₁, p₅}, {c₁, p₁}, {c₁, p₁}, {c₁,        p₆},    -   {c₂, p₁}, {c₂, p₄}, {c₂, p₅},    -   {c₃, p₂}, {c₃, p₅}.

Next, on the basis of the patterns so formed, behavior patterns areformed in addition, containing one parameter each and all the commandswhich can be described by that parameter:

-   -   {c₁, c₂, p₁},    -   {c₁, c₃, p₂},    -   {c₁, c₂, c₃, p₅},

Next, on the basis of the patterns so formed, behavior patterns areformed in addition, containing several parameters each and all thecommands which can be described by those parameters at the same time:

-   -   {c₁, c₂, p₁, p₅}.

In one variant aspect of the system, the commands and parameters areselected from the behavior log on the basis of rules by which areselected at least:

-   -   every i-th command in succession and the parameters describing        it, the increment i being predetermined;    -   the commands executed after a predetermined period of time (for        example, every tenth second) from the previous selected command,        and describing their parameters;    -   the commands and the parameters describing them that are        executed in a predetermined time interval from the start of        execution of the file;    -   the commands from a predetermined list and the parameters        describing them;    -   the parameters from a predetermined list and the commands which        can be described by those parameters;    -   the first or the random k parameters of commands in the case        when the number of command parameters is greater than a        predetermined threshold value.

For example, all the commands for working with a hard disk (such asCreateFile, ReadFile, WriteFile, DeleteFile, GetFileAttribute and so on)are selected from the behavior log, and all the parameters describingthe selected commands.

In yet another example, every thousandth command is selected from thebehavior log, and all the parameters describing the selected commands.

In one variant aspect of the system, the behavior logs are formed inadvance from at least two files, one of which is a safe file and theother a malicious file.

In yet another variant aspect of the system, each element of a behaviorpattern is matched up with a characteristic such as the type of elementof the behavior pattern. The type of element of the behavior pattern(command or parameter) is at least:

-   -   a “number range”, if the element of the behavior pattern can be        expressed as a number        for example, for an element of the behavior pattern constituting        the parameter port_(html)=80 of the connect command, the type of        said element of the behavior pattern may be the “number range        from 0x0000 to 0xFFFF”,    -   a “string”, if the element of the behavior pattern can be        expressed in the form of a string        for example, for an element of the behavior pattern constituting        the connect command, the type of said element of the behavior        pattern may be a “string less than 32 characters in size”,    -   if the element of the behavior pattern can be expressed in the        form of data which can be described by a predetermined data        structure, the type of that element of the behavior pattern may        be a “data structure”        for example, for an element of the behavior pattern constituting        the parameter src=0x336b9a480d490982cdd93e2e49fdeca7 of the        find_record command, the type of said element of the behavior        pattern may be the “data structure MD5”.

In yet another variant aspect of the system, the behavior patternadditionally includes, as elements of the behavior pattern, tokensformed on the basis of lexical analysis of said elements of the behaviorpattern using at least:

-   -   predetermined rules for the formation of lexemes,    -   a previously trained recurrent neural network.

For example, with the aid of lexical analysis of the parameter

-   -   ‘c:\windows\system32\data.pass’        on the basis of the rules for formation of lexemes:    -   if the string contains the path to a file, determine the disk on        which the file is located;    -   if the string contains the path to a file, determine the folders        in which the file is located;    -   if the string contains the path to a file, determine the file        extension;

where the lexemes are:

-   -   the paths to the file;    -   the folders in which the files are located;    -   the names of the files;    -   the extensions of the files;

the following tokens can be formed:

-   -   “paths to the file”→        -   ‘c:\’,    -   “folders in which the files are located”→        -   ‘windows’,        -   ‘system32’,        -   ‘windows\system32’,    -   “extensions of the files”→        -   ‘.pass’.

In yet another example, with the aid of lexical analysis of theparameters

-   -   ‘81.19.82.8’, ‘81.19.72.38’, ‘81.19.14.32’

on the basis of the rule for formation of a lexeme:

-   -   if the parameters constitute IP addresses, determine the bit        mask (or its analog, expressed by meta-characters) describing        said IP addresses (i.e. the bit mask M for which the equality        M∧IP=const is true for all those IPs);

the following token can be formulated:

-   -   ‘81.19.*.*’.

In yet another example, from all available parameters comprisingnumbers, the tokens of the numbers are formed in predetermined ranges:

-   -   23, 16, 7224, 6125152186, 512, 2662162, 363627632, 737382, 52,        2625, 3732, 812, 3671, 80, 3200

and sorted by ranges of numbers:

-   -   from 0 to 999        -   →{16, 23, 52, 80, 512, 812},    -   from 1000 to 9999        -   →{2625, 3200, 3671, 7224},    -   from 10000 on        -   →{737382, 2662162, 363627632, 6125152186}

In yet another variant aspect of the system, tokens are formed fromelements of a behavior pattern which consist of strings.

For example, the behavior pattern is the path to a file containing thenames of the disk, the director, the file, the file extension, and soforth. In this case, the token may be the name of the disk and the fileextension.

-   -   C:\Windows\System32\drivers\acpi.sys    -   →    -   C:\    -   *.sys

The convolution function forming module 122 is designed to:

-   -   form a convolution function from the behavior pattern such that        the inverse convolution function of the result of that        convolution function performed on the obtained behavior pattern        will have a degree of similarity with the obtained behavior        pattern greater than a specified value, i.e.        r˜g ⁻¹(g(r))    -   where:        -   r_(i) is the behavior pattern,        -   g is the convolution function,        -   g⁻¹ is the inverse convolution function.    -   send the convolution function so formed to the detection model        machine learning module 132.

In one variant aspect of the system, the convolution function formingmodule 122 is additionally designed to:

-   -   compute the feature vector of a behavior pattern on the basis of        the obtained behavior pattern, wherein the feature vector of the        behavior pattern may be expressed as the sum of the hash sums of        the elements of the behavior pattern;    -   form a convolution function from the feature vector of the        behavior pattern, wherein the convolution function constitutes a        hash function such that the degree of similarity of the computed        feature vector and the result of the inverse hash function of        the result of that hash function of the calculated feature        vector is greater than a predetermined value.

In yet another variant aspect of the system, the convolution function isformed by the metric learning method, i.e. in such a way that thedistance between the convolutions obtained with the aid of saidconvolution function for behavior patterns having a degree of similaritygreater than a predetermined threshold value is less than apredetermined threshold value, while for behavior patterns having adegree of similarity less than the predetermined threshold value it isgreater than the predetermined threshold value.

For example, the feature vector of the behavior pattern may be computedas follows:

-   -   first an empty bit vector is created, consisting of 100 000        elements (where one bit of information is reserved for each        element of the vector);    -   1000 elements from the behavior pattern r are set aside for        storing data about the commands c_(i), the remaining 99 000        elements are set aside for the parameters c_(i) of the behavior        pattern r, wherein 50 000 elements (from element 1001 to element        51 000) are set aside for string parameters and 25 000 elements        (from element 51 001 to element 76 000) for number parameters;    -   each command c_(i) of the behavior pattern r is matched up with        a certain number x_(i) from 0 to 999, and the corresponding bit        is set in the vector so created        v[x _(i)]=true;    -   for each parameter p_(i) of the behavior pattern r the hash sum        is calculated by the formula:        -   for strings: y_(i)=1001+crc32(p_(i)) (mod 50000)        -   for numbers: y_(i)=51001+crc32(p_(i)) (mod 25000)        -   for the rest: y_(i)=76001+crc32(p_(i)) (mod 24000),    -   and depending on the calculated hash sum the corresponding bit        is set in the vector so created        v[y _(i)]=true;

The described bit vector with the elements so set constitutes thefeature vector of the behavior pattern r.

In yet another variant aspect of the system, the feature vector of thebehavior pattern is computed by the formula:

$D = {\sum\limits_{i}{b^{i} \times {h\left( r_{i} \right)}}}$where:

-   -   b is the base of the positional system of computation (for        example, for a binary vector b=2, for a vector representing a        string, i.e. a group of characters, b=8),    -   r_(i) is the i-th element of the behavior pattern,    -   h is the hash function, where 0≤h(r_(i))<b.

For example, the feature vector of the behavior pattern may be computedas follows:

-   -   first yet another empty bit vector (different from the previous        example) is created, consisting of 1000 elements (where one bit        of information is reserved for each element of the vector);    -   the hash sum for each pattern element r_(i) of the behavior        pattern r is calculated by the formula:        x _(i)=2^(crc32(r) ^(i) ^()(mod 1000)),        and depending on the computed hash sum, set the corresponding        bit in the vector so created        v[x _(i)]=true;

In yet another variant aspect of the system, the feature vector of thebehavior pattern constitutes a Bloom filter.

For example, the feature vector of the behavior pattern may be computedas follows:

-   -   first yet another empty vector (different from the previous        examples) is created, consisting of 100 000 elements;    -   at least two hash sums for each pattern element r_(i) of the        behavior pattern r are calculated with the aid of a set of hash        functions {h_(j)} by the formula:        x _(ij) =h _(j)(r _(i))        where:        h _(j)(r _(i))=crc32(r _(i)),        h _(j)(0)=const_(j),        and depending on the computed hash sums, set the corresponding        elements in the vector so created        v[x _(ij)]=true.

In yet another variant aspect of the system, the size of the result ofthe formulated convolution function of the feature vector of thebehavior pattern is less than the size of said feature vector of thebehavior pattern.

For example, the feature vector constitutes a bit vector containing 100000 elements, and thus has a size of 12 500 bytes, while the result ofthe convolution function of said feature vector constitutes a set ofeight MD5 hash sums and thus has a size of 256 bytes, i.e. ^(˜)2% of thesize of the feature vector.

In yet another variant aspect of the system, the degree of similarity ofthe feature vector and the result of the inverse hash function of theresult of said hash function of the computed feature vector constitutesa number value in the range of 0 to 1 and is calculated by the formula:

$w = \frac{\Sigma\left( {\left\{ {h\left( r_{i} \right)} \right\}\bigwedge\left\{ g_{i} \right\}} \right)}{\Sigma\left\{ {h\left( r_{i} \right)} \right\}}${h(r_(i))}⋀{g_(i)}∀{h(r_(i))} = {g_(i)}where:

-   -   h(r_(i))∧g_(i) signifies the congruence of h(r_(i)) with g_(i)        and    -   {h(r_(i))} is the set of results of the hash functions of the        elements of the behavior pattern,    -   {g_(i)} is the set of results of the inverse hash function of        the result of the hash function of the elements of the behavior        pattern,    -   r_(i) is the i-th element of the behavior pattern,    -   h is the hash function,    -   w is the degree of similarity.

For example, the computed feature vector constitutes the bit vector

-   -   1010111001100100101101110111111010001000110010010010011101011011010        10001100110110100100010000001011101110011011011,        the result of the convolution function of this feature vector is    -   1010011110101110101,        and the result of the inverse convolution function of the        above-obtained result is    -   1010111001 0001001011 0111001111 1010001000 1100100101        0001110101 1011011 1000110011 0110100000 0100000010 1110111001        1011011

(where the bolding denotes elements different from the feature vector).Thus, the similarity of the feature vector and the result of the inverseconvolution function is 0.92.

In yet another variant aspect of the system, the aforementioned hashfunction using an element of the behavior pattern as a parameter dependson the type of element of the behavior pattern:h(r _(i))=h _(r) _(i) (r _(i)).

For example, in order to calculate the hash sum of a parameter from thebehavior pattern constituting a string containing the path to the file,the hash function CRC32 is used; for any other string, the Hoffmanalgorithm; for a data set, the hash function MD5.

In yet another variant aspect of the system, the forming of theconvolution function of the feature vector of a behavior pattern iscarried out by an auto-encoder, wherein the input data are the elementsof said feature vector of the behavior pattern, and the output data aredata having a coefficient of similarity to the input data greater than apredetermined threshold value.

The detection model creation module 131 is designed to:

-   -   create a model for detection of malicious files, including at        least:        -   selection of a method for machine learning by the detection            model;        -   initialization of the parameters of the training model,            wherein the parameters of the training model which were            initialized prior to the start of the machine learning by            the detection model are known as hyper parameters;    -   depending on the parameters of the files selected by the        training selections preparation module 111;    -   send the training model so created to the detection model        machine learning module 132.

For example, when selecting the method for machine learning by thedetection model, at first a decision is made whether to use as thedetection model an artificial neural net or a random forest, then if therandom forest is chosen the separating criterion for the nodes of therandom forest is selected; or if an artificial neural net is chosen, themethod of numerical optimization of the parameters of the artificialneural net are selected. Furthermore, the decision as to the choice of aparticular method for machine learning is made on the basis of theeffectiveness of that method in the detecting of malicious files (i.e.the number of errors of the first and second kind occurring in thedetecting of malicious files) using input data (behavior patterns) of apredetermined kind (i.e. the data structure, the number of elements ofthe behavior patterns, the performance of the computing device on whichthe search for malicious files is being conducted, the availableresources of the computing device, and so on).

In yet another example, the method for machine learning by the detectionmodel is selected on the basis of at least:

-   -   cross testing, sliding check, cross-validation (CV);    -   mathematical validation of the criteria AIC, BIC and so on;    -   A/B testing, split testing;    -   stacking.

In yet another example, in the event of low performance of the computingdevice, random forest is chosen, otherwise the artificial neural net ischosen.

In one variant aspect of the system, machine learning is performed for apreviously created untrained detection model (i.e. a detection model inwhich the parameters of that model cannot produce, on the basis ofanalysis of the input data, output data with accuracy higher than apredetermined threshold value).

In yet another variant aspect of the system, the method of machinelearning by the detection model is at least:

-   -   decision tree-based gradient boosting;    -   decision trees;    -   the k-nearest neighbor method;    -   the support vector machine (SVM) method.

In yet another variant aspect of the system, the detection modelcreation module 131 is additionally designed to create a detection modelon demand from the detection model machine learning module 132, whereincertain hyper parameters and methods of machine learning are chosen tobe different from the hyper parameters and machine learning methodschosen for a previous detection model.

The detection model machine learning module 132 is designed to train thedetection model, in which the parameters of the detection model arecomputed using the obtained convolution function on the obtainedbehavior patterns, where the detection model constitutes a set of rulesfor computing the degree of maliciousness of a file on the basis of atleast one behavior pattern using the computed parameters of saiddetection model.

For example, the detection model is trained on a known set of filesselected by the training selections preparation module 111, wherein saidset of files contains 60% safe files and 40% malicious files.

In one variant aspect of the system, the degree of maliciousness of afile constitutes a numerical value from 0 to 1, where 0 means that thefile is safe, and 1 that it is malicious.

In yet another variant aspect of the system, a method of training thedetection model is chosen which ensures a monotonic change in the degreeof maliciousness of a file depending on the change in the number ofbehavior patterns formed on the basis of analysis of the behavior log.

For example, a monotonic change in the degree of maliciousness of a filemeans that, upon analyzing each subsequent behavior pattern, thecalculated degree of maliciousness will be not less than the previouslycalculated degree of maliciousness (for example, after analysis of the10th behavior pattern, the calculated degree of maliciousness is equalto 0.2; after analysis of the 50th behavior pattern, it is 0.4; andafter analysis of the 100th behavior pattern it is 0.7).

In yet another variant aspect of the system, the detection model machinelearning module 132 is additionally designed to:

-   -   perform a check of the trained detection model on the obtained        behavior logs formed on the basis of analysis of files from a        test selection of files, in order to determine the correctness        of determination of the maliciousness of files from the test        selection of files;    -   in the event of a negative result of the check, send a request        at least:        -   to the training selections preparation module 111 to prepare            a selection of files different from the current one used for            the training of the detection model;        -   to the detection model creation module 131 to create a new            detection model, different from the current one.

Furthermore, the checking of the trained detection model involves thefollowing. Said detection model has been trained on the basis of a setof files selected by the training selections preparation module 111 forwhich it was known whether they are safe or malicious. In order toverify that the model for detection of malicious files has been trainedcorrectly, i.e. said detection model is able to detect malicious filesand pass over safe files, a checking of said model is performed. Forthis purpose, said detection model is used to determine whether filesfrom another set of files selected by the training selectionspreparation module 111 are malicious, it being known in advance whetherthose files are malicious. Thus, it is determined how many maliciousfiles were “missed” and how many safe files were detected. If the numberof missed malicious files and detected safe files is greater than apredetermined threshold value, that detection model is considered to beimproperly trained and a repeat machine learning needs to be done for it(for example, on another training selection of files, using values ofthe parameters of the detection model different from the previous ones,and so forth).

For example, when performing the check of the trained model the numberof errors of the first and second kind in detecting malicious files froma test selection of files is checked. If the number of such errors isgreater than a predetermined threshold value, a new training and testingselection of files is selected and a new detection model is created.

In yet another example, the training selection of files contained 10 000files, of which 8500 were malicious and 1500 were safe. After thedetection model was trained, it was checked on a test selection of filescontaining 1200 files, of which 350 were malicious and 850 were safe.According to the results of the check performed, 15 out of 350 maliciousfiles were not detected successfully (4%), while 102 out of 850 safefiles (12%) were erroneously considered to be malicious. In the eventthat the number of undetected malicious files exceeds 5% or accidentallydetected safe files exceeds 0.1%, the trained detection model isconsidered to be improperly trained.

In one variant aspect of the system, the behavior log of the system isadditionally formed on the basis of a previously formed log of thebehavior of the system and of commands intercepted after the forming ofsaid behavior log of the system.

For example, after the start of the execution of a file for which it isnecessary to give a verdict as to the maliciousness or safety of thatfile, the intercepted executable commands and the parameters describingthem are recorded in the behavior log. On the basis of an analysis ofthese commands and parameters, the degree of maliciousness of that fileis calculated. If no decision was made as to the file being recognizedas malicious or safe based on the results of the analysis, theintercepting of commands may be continued. The intercepted commands andthe parameters describing them are recorded in the old behavior log orin a new behavior log. In the first case, the degree of maliciousness iscalculated on the basis of an analysis of all commands and parametersrecorded in the behavior log, i.e. even those previously used tocalculate the degree of maliciousness.

The degree of maliciousness calculation module 142 is designed to:

-   -   calculate the degree of maliciousness on the basis of the        behavior log obtained from the behavior log forming module 112        and the detection model obtained from the detection model        machine learning module 132, the degree of maliciousness of a        file being a quantitative characteristic (for example, lying in        the range from 0—the file has only safe behavior—to 1—the file        has predetermined malicious behavior), describing the malicious        behavior of the file being executed;        -   send the calculated degree of maliciousness to the resource            management module 143.

The resource management module 143 is designed to allocate computingresources of the computer system on the basis of the analysis of theobtained degree of maliciousness, for use in assuring the security ofthe computer system.

In one variant aspect of the system, the computing resources of thecomputer system are at least:

-   -   the volume of free RAM;    -   the volume of free space on the hard disks;    -   the free processor time (quanta of processor time) which can be        spent on the antivirus scan (for example, with a greater depth        of emulation).

In yet another variant aspect of the system, the analysis of the degreeof maliciousness consists in determining the dynamics of the change inthe value of degree of maliciousness after each of the precedingcalculations of the degree of maliciousness and at least:

-   -   allocating additional resources of the computer system in the        event of an increase in the value of the degree of        maliciousness;    -   freeing up previously allocated resources of the computer system        in the event of a decrease in the value of the degree of        maliciousness.

FIG. 2 shows the structural diagram of the method for machine learningby a model for detection of malicious files.

The structural diagram of the method for machine learning by a model fordetection of malicious files contains a step 211 in which trainingselections of files are prepared, a step 212 in which behavior logs areformed, a step 221 in which behavior patterns are formed, a step 222 inwhich convolution functions are formed, a step 231 in which a detectionmodel is created, a step 232 in which the detection model is trained, astep 241 in which the behavior of the computer system is tracked, a step242 in which the degree of maliciousness is calculated, and a step 243in which the resources of the computer system are managed.

In step 211, the training selections preparation module 111 is used toselect at least one file from a database of files according topredetermined criteria, wherein the training of the detection model willbe carried out in step 232 on the basis of the selected files.

In step 212, the behavior log forming module 112 is used:

-   -   to intercept at least one command at least during:        -   the execution of the file selected in step 211,        -   the emulation of the working of the file selected in step            211;    -   to determine for each intercepted command at least one parameter        describing that command;    -   to form, on the basis of the commands intercepted and the        parameters determined, a behavior log of the obtained file,        wherein the behavior log represents the set of intercepted        commands (hereinafter, command) from the file, where each        command corresponds to at least one defined parameter describing        that command (hereinafter, parameter).

In step 221, the behavior pattern forming module 121 is used to form atleast one behavior pattern on the basis of the commands and parametersselected from the behavior log formed in step 212, wherein the behaviorlog represents the set of executable commands (hereinafter, command)from the file, where each command corresponds to at least one parameterdescribing that command (hereinafter, parameter), the behavior patternbeing a set of at least one command and parameter which describes allthe commands from that set.

In step 222, the convolution function forming module 122 is used to forma convolution function of the behavior pattern formed in step 221 suchthat the inverse convolution function of the result of this convolutionfunction performed on that behavior pattern will have a degree ofsimilarity to the aforementioned behavior pattern greater than aspecified value.

In step 231, the detection model creation module 131 is used to create adetection model, for which at least:

-   -   a method of machine learning by the detection model is selected;    -   the parameters of the training model are initialized, wherein        the parameters of the training model initialized prior to the        start of the machine learning by the detection model are known        as hyper parameters;

depending on the parameters of the files selected in step 211.

In step 232, the detection model machine learning module 132 is used totrain the detection model created in step 231, in which the parametersof that detection model are calculated using the convolution functionformed in step 222, performed on the behavior patterns formed in step221, where the detection model constitutes a group of rules forcalculating the degree of maliciousness of a file on the basis of atleast one behavior pattern using the calculated parameters of thatdetection model.

In step 241, the behavior tracking module 141 is used:

-   -   to intercept at least one command being executed by the files        running in the computer system;    -   to form a behavior log of the system on the basis of the        intercepted commands.

In step 242, the degree of maliciousness calculation module 142 is usedto calculate the degree of maliciousness on the basis of the behaviorlog of the system formed in step 241 and of the detection model trainedin step 232.

In step 243, the resource management module 143 is used to allocatecomputing resources on the basis of the analysis of the degree ofmaliciousness as calculated in step 242, for use in assuring thesecurity of the computer system.

FIG. 3 shows examples of the dynamics of change in the degree ofmaliciousness as a function of the number of behavior patterns.

The examples of the dynamics of change in the degree of maliciousness asa function of the number of behavior patterns contain a graph 311 of thedynamics of an arbitrary change in the degree of maliciousness as afunction of the number of behavior patterns formed during the executionof a malicious file, a graph 312 of the dynamics of monotonic change inthe degree of maliciousness as a function of the number of behaviorpatterns formed during the execution of a malicious file, a graph 321 ofthe dynamics of an arbitrary change in the degree of maliciousness as afunction of the number of behavior patterns formed during the executionof a safe file, and a graph 322 of the dynamics of monotonic change inthe degree of maliciousness as a function of the number of behaviorpatterns formed during the execution of a safe file.

In one variant aspect of the system, the degree of maliciousness of afile being executed takes on a value in the range of 0 (the file hasabsolutely safe behavior) to 1 (the file has predetermined maliciousbehavior).

The graph 311 shows the dynamics of an arbitrary change in the degree ofmaliciousness as a function of the number of behavior patterns formedduring the execution of a malicious file.

In the beginning, upon executing said file the number of behaviorpatterns formed is not large, and what is more the malicious activity ofthe file being executed might be absent or minimal (for example, aninitialization of data occurs, which is natural to many files, includingsafe ones), so that the calculated degree of maliciousness differslittle from 0 and does not exceed the predetermined threshold value(hereinafter, the criterion of safety), upon exceeding which thebehavior of the file being executed will cease to be considered safe (onthe graph, this threshold value is designated by a dotted line).

However, in time the malicious activity of the file being executed growsand the degree of maliciousness begins to approach 1, exceeding thecriterion of safety, while the degree of maliciousness might not reachthe predetermined threshold value (hereinafter, the criterion ofmaliciousness) upon exceeding which the behavior of the file beingexecuted will be considered to be malicious (on the graph, thisthreshold value is designated by a dashed line).

After a period of growth, the malicious activity may cease and thedegree of maliciousness will again approach 0 (time A). At a certaintime, the degree of maliciousness becomes greater than the criterion ofmaliciousness (time B) and the behavior of the file being executed willbe recognized as malicious and in consequence the file itself isrecognized as malicious.

Furthermore, the time of recognizing the file as malicious might occursignificantly later than the start of growth in malicious activity,since the described approach responds well to an abrupt growth in thedegree of maliciousness, which occurs most often during prolonged,clearly manifested malicious activity of the file being executed.

In the case when the malicious activity occurs episodically (left sideof the graph 311), the calculated degree of maliciousness might notreach the value after which a decision is made as to the maliciousnessof the behavior of the file, and consequently the maliciousness of thefile being executed itself.

In the case when the degree of maliciousness is calculated not on thebasis of each behavior pattern formed (for example, because theperformance of the computing device is not high), a situation ispossible where the degree of maliciousness will be calculated at time A(when the malicious activity commences) and time C (when the maliciousactivity is finished), but will not be calculated at time B (whenmalicious activity is occurring), so that the calculated degrees ofmaliciousness will not exceed the criterion of maliciousness, theactivity of the file being executed will not be recognized as malicious,and consequently the malicious file will not be detected.

The graph 312 shows the dynamics of monotonic change in the degree ofmaliciousness as a function of the number of behavior patterns formedduring the execution of a malicious file.

In the beginning, upon executing said file the number of behaviorpatterns formed is not large, and what is more the malicious activity ofthe file being executed might be absent or minimal (for example, aninitialization of data occurs, which is natural for many files,including safe ones), so that the calculated degree of maliciousnessdiffers little from 0 and does not exceed the predetermined thresholdvalue (hereinafter, the criterion of safety), upon exceeding which thebehavior of the file being executed file will cease to be consideredsafe (on the graph, this threshold value is designated by a dottedline).

However, in time the malicious activity of the file being executed growsand the degree of maliciousness begins to approach 1, exceeding thecriterion of safety, while the degree of maliciousness might not reachthe predetermined threshold value (hereinafter, the criterion ofmaliciousness) upon exceeding which the behavior of the file beingexecuted will be considered to be malicious (on the graph, thisthreshold value is designated by a dashed line).

After a period of growth (times A-B), the malicious activity may cease(times B-A), yet the degree of maliciousness will not now decline, butonly continue to grow during any malicious activity of the file beingexecuted. At a certain time, the degree of maliciousness becomes greaterthan the criterion of maliciousness (time D) and the behavior of thefile being executed will be recognized as malicious and in consequencethe file itself is recognized as malicious.

Furthermore, the time of recognizing the file as malicious might occurimmediately after the manifesting of malicious activity, since thedescribed approach responds well to a smooth growth in the degree ofmaliciousness, which occurs both during prolonged, clearly manifestedmalicious activity of the file being executed and during frequentepisodic less pronounced malicious activity.

In the case when the malicious activity occurs episodically (left sideof the graph 311), the calculated degree of maliciousness over timemight reach the value after which a decision is made as to themaliciousness of the behavior of the file being executed and themaliciousness of the file being executed itself.

In the case when the degree of maliciousness is calculated not on thebasis of each behavior pattern formed (for example, because theperformance of the computing device is not high), a situation ispossible where the degree of maliciousness will be calculated at time A(when the malicious activity commences) and time C (when the maliciousactivity is finished), but will not be calculated at time B (whenmalicious activity is occurring), nevertheless, since the degree ofmaliciousness changes monotonically, the calculated degrees ofmaliciousness only increase their values and at time C the degree ofmaliciousness will exceed the criterion of maliciousness, the activityof the file being executed will be recognized as malicious, andconsequently the malicious file will be detected.

The graph 321 shows the dynamics of an arbitrary change in the degree ofmaliciousness as a function of the number of behavior patterns formedduring the execution of a safe file.

In the beginning, upon executing said file the number of behaviorpatterns formed is not large, and what is more there is no maliciousactivity as such for the file being executed, but “suspicious” commandsmight be performed which may also be performed during the execution ofmalicious files (for example, deletion of files, transfer of data in acomputer network, and so on), therefore the calculated degree ofmaliciousness differs from 0 and does not exceed the predeterminedthreshold value (hereinafter, the criterion of safety), upon exceedingwhich the behavior of the file being executed will cease to beconsidered safe (on the graph, this threshold value is designated by adotted line).

However, in time the malicious activity of the file being executed growson account of the execution of a large number of “suspicious” commandsand the degree of maliciousness begins to approach 1, while the degreeof maliciousness might not reach the predetermined threshold value(hereinafter, the criterion of maliciousness) upon exceeding which thebehavior of the file being executed will be considered to be malicious(on the graph, this threshold value is designated by a dashed line), butit might exceed the criterion of safety, so that the file may cease tobe considered safe and become “suspicious”.

After a period of growth, the malicious activity may cease and thedegree of maliciousness will again approach 0 (time C).

In the case when the degree of maliciousness is calculated not on thebasis of each behavior pattern formed (for example, because theperformance of the computing device is not high), a situation ispossible where the degree of maliciousness will be calculated at time B(when the activity is most similar to malicious, i.e. becomes“suspicious”) but will not be calculated at time A (when the“suspicious” activity is increasing) or at time C (when the “suspicious”activity is decreasing), so that the calculated degree of maliciousnesswill exceed the criterion of safety, the activity of the file beingexecuted will be recognized as “suspicious” (will not be consideredsafe), and consequently the safe file will not be recognized as safe.

The graph 321 shows the dynamics of monotonic change in the degree ofmaliciousness as a function of the number of behavior patterns formedduring the execution of a safe file.

In the beginning, upon executing said file the number of behaviorpatterns formed is not large, and what is more there is no maliciousactivity as such for the file being executed, but “suspicious” commandsmight be performed, which may also be performed during the execution ofmalicious files (for example, deletion of files, transfer of data in acomputer network, and so on), therefore the calculated degree ofmaliciousness differs from 0 and does not exceed the predeterminedthreshold value (hereinafter, the criterion of safety), upon exceedingwhich the behavior of the file being executed will cease to beconsidered safe (on the graph, this threshold value is designated by adotted line).

However, in time the malicious activity of the file being executed growson account of the execution of a large number of “suspicious” commandsand the degree of maliciousness begins to approach 1, while the degreeof maliciousness might not reach the predetermined threshold value(hereinafter, the criterion of maliciousness) upon exceeding which thebehavior of the file being executed will be considered to be malicious(on the graph, this threshold value is designated by a dashed line), andalso it might not exceed the criterion of safety, so that the file willcontinue to be considered safe.

After a period of growth (times A-B), the malicious activity may cease(times B-A), yet the degree of maliciousness will not now decline, butonly continue to grow during any malicious activity of the file beingexecuted, yet not exceed the coefficient of safety, so that the activityof the file being executed will be considered to be safe and inconsequence the file will be considered to be safe.

In the case when the degree of maliciousness is calculated not on thebasis of each behavior pattern formed (for example, because theperformance of the computing device is not high), a situation ispossible where the degree of maliciousness will be calculated at time B(when the activity is most similar to malicious, i.e. becomes“suspicious”) but will not be calculated at time A (when the“suspicious” activity is increasing) or at time C (when the “suspicious”activity is decreasing), nevertheless, since the degree of maliciousnesschanges monotonically, the calculated degrees of maliciousness will onlyincrease their values, at times A, B, C the degrees of maliciousnesswill not exceed the criterion of safety, the activity of the file beingexecuted will be recognized as safe, and consequently the safe file willbe recognized as safe.

Furthermore, the time of recognizing the file as “suspicious” might notoccur after the manifesting of “suspicious” activity, since thedescribed approach affords to a smooth growth in the degree ofmaliciousness, which makes it possible to avoid sharp peaks in thegrowth of the degree of maliciousness.

FIG. 4 shows an example of the diagram of relations between elements ofbehavior patterns.

The example of the diagram of relations between elements of behaviorpatterns contains commands 411 (clear circles), parameters 412 (hatchedcircles), an example of a behavior pattern with one parameter 421, andan example of a behavior pattern with one command 422.

During the execution of a file, the commands 411 were intercepted andthe parameters 412 describing them were determined:

-   -   CreateFile 0x24e0da54 ‘.dat’        -   {c1, p1, p2}    -   ReadFile 0x24e0da54 ‘.dat’        -   {c2, p1, p2}    -   DeleteFile 0x24e0da54 ‘.dat’‘c:\’        -   {c3, p1, p2, p3}    -   CreateFile 0x708a0b32 ‘.dat’ 0x3be06520        -   {c1, p2, p3, p5}    -   WriteFile 0x708a0b32        -   {c4, p3}    -   WriteFile 0x708a0b32 0x3be06520 0x9902a18d1718b512472819 0        -   {c4, p3, p5, p6, p7}    -   CopyMemory 0x3be06520 0x9902a18d1718b512472819        -   {c5, p4, p5, p6}    -   ReadFile 0x9902a18d1718b5124728f9 0        -   {c2, p6, p7}

On the basis of said commands 411 and parameters 412, behavior patterns(421, 422) are formed and the relations between the elements of thebehavior patterns are determined.

In a first step, patterns are formed which contain one command 411 andone parameter 412 describing that command:

-   -   {c1, p1}    -   {c1, p2}    -   {c1, p3}    -   {c1, p5}    -   {c2, p1}    -   {c2, p2}    -   {c2, p6}    -   {c2, p7}    -   {c3, p1}    -   {c3, p2}    -   {c3, p3}    -   {c4, p3}    -   {c4, p5}    -   {c4, p6}    -   {c4, p7}    -   {c5, p4}    -   {c5, p5}    -   {c5, p6}

In the example shown, 19 behavior patterns have been formed on the basisof 8 intercepted commands (with the parameters describing them).

In the second step, patterns are formed which contain one parameter 412and all the commands 411 which can be described by that parameter 412:

-   -   {c1, c2, c3, p1}    -   {c1, c2, c3, p2}    -   {c1, c4, c5, p5}    -   {c2, c4, c5, p6}    -   {c1, c3, c4, p3}    -   {c5, p4}    -   {c2, c4, p7}

In the example shown, 7 behavior patterns have been formed in additionon the basis of 8 intercepted commands (with the parameters describingthem).

In the third step, patterns are formed which contain several parameters412 and all the commands 411 which can be described by those patterns412:

-   -   {c1, c2, c3, p1, p2}    -   {c4, c5, p5, p6}    -   {c2, c4, p6, p7}

In the example shown, 3 behavior patterns have been formed in additionon the basis of 8 intercepted commands (with the parameters describingthem).

FIG. 5 shows the structural diagram of the system of detection ofmalicious files using a trained model for detection of malicious files.

The structural diagram of the system of detection of malicious filesusing a trained model for detection of malicious files consists of thefile being analyzed 501, a behavior log forming module 112, a detectionmodel selection module 520, a database of detection models 521, abehavior log analysis module 530, a degree of maliciousness calculationmodule 540, a database of decision templates 541 and a analysis module550.

In one variant aspect of the system, the system additionally contains abehavior log forming module 112 of the file being executed, which isdesigned to:

-   -   intercept at least one command at least during:        -   the execution of the file 501;        -   the emulation of the execution of the file 501;    -   determine for each intercepted command at least one parameter        describing that command;    -   form on the basis of the intercepted commands and the determined        parameters a behavior log for that file, wherein the intercepted        commands and the parameters describing them are recorded in the        behavior log in chronological order from the earliest        intercepted command to the most recent intercepted command        (hereinafter, writing in the behavior log);    -   send the formulated behavior log to the behavior log analysis        module 530 and the detection model selection module 520.

In yet another variant aspect of the system, the behavior log is a setof executable commands (hereinafter: command) of the file 501, whereeach command corresponds to at least one parameter describing thatcommand (hereinafter: parameter).

In yet another variant aspect of the system, the intercepting ofcommands of the file being executed 501 and the determination of theparameters of the intercepted commands is carried out on the basis of ananalysis of the performance of the computing device on which the systemfor detecting malicious files using a trained model for detection ofmalicious files is running, which includes at least:

-   -   determining whether it is possible to analyze the file being        executed 501 for maliciousness (carried out with the aid of the        behavior log analysis module 530, the degree of maliciousness        calculation module 540 and the analysis module 550) up to the        time when the next command is intercepted;    -   determining as to whether the analysis of the file being        executed 501 for maliciousness will result in a lowering of the        computing resources of the aforementioned computing device below        a predetermined threshold value, the resources of the computing        device being at least:        -   the performance of that computing device;        -   the volume of free RAM of that computing device;        -   the volume of free space on information storage media of            that computing device (such as hard disks);        -   the bandwidth of the computer network to which that            computing device is connected.

In order to increase the performance of the system of detection ofmalicious files using a trained model for detection of malicious filesit may be necessary to analyze a behavior log not containing all theexecutable commands of the file being executed 501, since the entiresequence of actions carried out to analyze the file 501 formaliciousness takes up more time than the interval between twoconsecutively executed commands of the file being executed 501.

For example, the commands of the file being executed 501 are carried out(and consequently also intercepted) every 0.001 s, but the analysis ofthe file 501 for maliciousness takes 0.15 s, so that all the commandsintercepted during the aforementioned interval of time will be ignored,so that it is enough to intercept only every 150th command.

The detection model selection module 520 is designed to:

-   -   select from the database of detection models 521 at least two        models for detection of malicious files on the basis of the        commands and parameters selected from the behavior log of the        file being executed 501, the model for detection of malicious        files being a decision-making rule for determining the degree of        maliciousness;    -   send all selected models for detection of malicious files to the        degree of maliciousness calculation module 540.

In one variant aspect of the system, the models for detection ofmalicious files kept in the database of detection models 521 have beenpreviously trained by the method of machine learning on at least onesafe file and one malicious file.

The model for detection of malicious files is described in greaterdetail in FIG. 1 to FIG. 4 .

In yet another variant aspect of the system, the method of machinelearning by the detection model is at least the method of:

-   -   gradient boosting on decision-making trees;    -   decision-making trees;    -   k-nearest neighbors;    -   support vectors.

In yet another variant aspect of the system, the method of training thedetection model ensures monotonic variation in the degree ofmaliciousness of the file depending on the variation in the number ofbehavior patterns formed on the basis of the analysis of the behaviorlog.

For example, the calculated degree of maliciousness of the file 501 mayonly increase monotonically or not change depending on the number ofbehavior patterns formed on the basis of the analysis of the behaviorlog of that file 501. At the start of the execution of the file 501, thenumber of behavior logs formed is slight, and the calculated degree ofmaliciousness of that file 501 differs little from 0; in time, thenumber of patterns formed increases and the calculated degree ofmaliciousness of that file 501 also increases, or if there is nomalicious activity of that file 501, the calculated degree ofmaliciousness remains unchanged; thus, whenever the degree ofmaliciousness of the file is calculated during the execution of amalicious file 501 (or from whatever record of the behavior log theforming of the behavior patterns begins), it will reflect whethermalicious activity of the file 501 has occurred or not up to the time ofcalculation of said degree of maliciousness.

In yet another variant aspect of the system, each model for detection ofmalicious files selected from the database of detection models 521 istrained to detect malicious files with predetermined uniquecharacteristic features.

For example, the detection models kept in the database of detectionmodels 521 may be trained to detect files:

-   -   which have a GUI—graphical user interface;    -   which exchange data in a computer network;    -   which encrypt files (such as malicious files of the        “Trojan-Cryptors” family);    -   which use for their propagation network vulnerabilities (such as        malicious files of the “Net-Worms” family), P2P networks (such        as malicious files of the “P2P-Worms” family), and so forth.

Thus, a malicious file may be detected using several trained models fordetection of malicious files. For example, the malicious file“WannaCry.exe”, which during its execution encrypts data on a user'scomputing device and sends copies of itself to other computing devicesconnected to the same computer network as the user's computing device onwhich it is being executed, can be detected with the aid of detectionmodel #1, trained to detect files utilizing vulnerabilities, detectionmodel #2, trained to detect files designed to encrypt files, anddetection model #3, trained to detect files containing text informationinterpretable as demands being made (for example, as to a form ofpayment, sums of money, and so forth). Furthermore, the degrees ofmaliciousness calculated with the aid of those models, as well as thetimes when the calculated degrees of maliciousness exceed thepredetermined threshold value, might differ from each other. Forexample, the results of using the models for detection of maliciousfiles with the aid of which the malicious file 501 was successfullydetected may be expressed in the following table:

TABLE #1 detection maximum degree command no. from model ofmaliciousness behavior log model #1 0.95 374 model #2 0.79 288 model #30.87 302

File 501 is recognized as malicious in the event that the calculateddegree of maliciousness is greater than 0.78. Furthermore, the degree ofmaliciousness (such as 0.78) characterizes the probability that the filefor which the degree of maliciousness has been calculated may prove tobe malicious (78%) or safe (22%). If the file 501 can be recognized asbeing malicious using several models for detection of malicious files,then there is a higher probability that the file 501 will prove to bemalicious. For example, for the models for detection of malicious filesthe data of which is presented in Table #1, the summary degree ofmaliciousness can be calculated by the formulaw _(total)=1−Π_(i) ^(n)(1−w _(i))=0.999685,

-   -   where    -   w_(total) is the summary degree of maliciousness,    -   w_(i) is the degree of maliciousness calculated using model i,    -   n is the number of models for detection of malicious files used        to calculate the summary degree of maliciousness.

Thus, the obtained summary degree of maliciousness (0.999685) issignificantly higher than the predetermined threshold value for which afile is recognized as malicious when its calculated degree ofmaliciousness exceeds that threshold (0.78). That is, the use of severalmodels for detection of malicious files allows substantially higheraccuracy of determination of malicious files, and fewer errors of thefirst and second kind occurring during detection of malicious files.

In yet another example, the use of several models for detection ofmalicious files allows the summary degree of maliciousness to attain thepredetermined threshold value for which a file is recognized asmalicious when its calculated degree of maliciousness exceeds thatthreshold much sooner than when using each of the models for detectionof malicious files separately. For example, for the models for detectionof malicious files the data of which are presented in Table #1, giventhat the calculated degrees of maliciousness vary monotonically, thenumber of the command from the behavior log after which the file will berecognized as malicious can be calculated by the formulaI _(detect)=Π_(i) ^(n) F(w _(i) ,I _(i))=207,

-   -   where        -   I_(detect) is the number of the command from the behavior            log after analysis of which the file is recognized as            malicious,        -   I_(i) is the number of the command from the behavior log            after analysis of which the file is recognized as malicious            using the model i,        -   w_(i) is the degree of maliciousness calculated using the            model i,        -   n is the number of models for detection of malicious files            used to calculate the number of the command from the            behavior log after analysis of which the file is recognized            as malicious.

Thus, the obtained summary number of the command from the behavior log(207) is much lower than the earliest number of the command from thebehavior log (288) after analysis of which the file was recognized asmalicious by one of the models for detection of malicious files (model#2). That is, the use of several models for detection of malicious filesmakes it possible to substantially increase the speed (i.e. theefficiency) of determination of malicious files.

In yet another example, the different detection models kept in thedatabase of detection models 521 may be trained to detect maliciousfiles with several not necessarily unique predetermined characteristicfeatures, i.e. detection model #1 can detect files having a graphicaluser interface and exchanging data in a computer network, while model #2can detect files exchanging data in a computer network and propagatingin that computer network using network vulnerabilities. Both of thosedetection models can detect the aforementioned malicious file“WannaCry.exe” thanks to the common characteristic feature of the filepropagating in a computer network using network vulnerabilities.

In yet another variant aspect of the system, a model for detection ofmalicious files selected from the database of detection models 521 thatwas trained on files during the execution of which at least:

-   -   the same commands were executed as the commands selected from        the behavior log of the file being executed 501;    -   the same parameters were used as the parameters selected from        the behavior log of the file being executed 501.

For example, the commands “CreateFileEx”, “ReadFile”, “WriteFile”, and“CloseHandle” were selected from the behavior log, which are used forthe modification of files, including the encryption of files. Adetection model trained for use in detecting malicious files of the“Trojan-Cryptors” family is selected from the database of detectionmodels 521.

In yet another example, the parameters “8080” and “21” were selectedfrom the behavior log, which describe commands for working with acomputer network (for example, connect, where the above-describedparameters are the connection ports to the electronic address). Adetection model trained for use in detecting files which ensure exchangeof data in a computer network is selected from the database of detectionmodels 521.

The behavior log analysis module 530 is designed to:

-   -   form at least one behavior pattern on the basis of the commands        and parameters selected from the behavior log of the file being        executed 501, wherein the behavior pattern is a set of at least        one command and a parameter which describes all the commands        from that set;    -   calculate the convolution of all the behavior patterns formed;    -   send the formed convolution to the degree of maliciousness        calculation module 540 of the file being executed.

In one variant aspect of the system, the calculation of the convolutionof the formed behavior patterns is based on a predetermined convolutionfunction, such that the inverse convolution function of the result ofthat convolution function performed on all of the formed behaviorpatterns has a degree of similarity to that behavior pattern greaterthan a predetermined threshold value.

The formation and use of the convolution functions (calculation of theconvolution) is described more closely in FIG. 1 and FIG. 2 .

The degree of maliciousness calculation module 540 is designed to:

-   -   calculate the degree of maliciousness of the file being executed        501 on the basis of an analysis of the obtained convolution with        the aid of each obtained model for detection of malicious files;    -   send each calculated degree of maliciousness to the analysis        module 550.

In one variant aspect of the system, the decision making template is acomposition of the degrees of maliciousness.

For example, the composition of the degrees of maliciousness calculatedon the basis of models #1, #2, #3, described above, can be representedas an aggregate of pairs {0.95, 374}, {0.79, 288}, {0.87, 302}.

In yet another example, the composition of the degrees of maliciousnesscalculated on the basis of models #1, #2, #3, described above, canrepresent a measure of the central tendency of the calculated degrees ofmaliciousness (such as the arithmetic mean, in the given case 0.87).

In yet another example, the composition of the degrees of maliciousnessrepresents the change in the degrees of maliciousness as a function oftime or the number of behavior patterns used to calculate the degree ofmaliciousness.

The analysis module 550 is designed to:

-   -   form a decision making template on the basis of the obtained        degrees of maliciousness;    -   recognize the file being executed 501 as malicious in the event        that the degree of similarity between the formed decision making        template and at least one of the predetermined decision making        templates from the database of decision making templates 541,        previously formed on the basis of an analysis of malicious        files, exceeds a predetermined threshold value.

In one variant aspect of the system, the decision making template is anaggregate of the degrees of maliciousness obtained from the degree ofmaliciousness calculation module 540.

In yet another variant aspect of the system, the decision makingtemplate is the degree of maliciousness as a function of time or thenumber of behavior patterns used to calculate that degree ofmaliciousness.

In yet another variant aspect of the system, the decision makingtemplates from the database of decision making templates 541 are formedon the basis of an analysis of malicious files which were used for thetraining of models from the database of detection models 521.

For example, on the basis of 100,000 files, of which 75,000 are safefiles and 25,000 are malicious files, the detection models are trained(including testing) and then saved in the database of detection models521. After the models for detection of malicious files have beentrained, they are used to form the decision making templates for certain(or all) of the aforementioned 25,000 malicious files, which are thenentered into the database of decision making templates 541. That is,machine learning by the models for detection of malicious files is firstcarried out on a learning and testing sample of files. As a result,several models for detection of malicious files can be trained, each ofwhich will be trained for the detection of malicious files with uniquepredetermined characteristic features. After all of the detection modelshave been trained, it is determined which ones of the trained models fordetection of malicious files detect certain malicious files (in theabove-described example, the 25 000 malicious files); it may turn outthat one malicious file can be detected using one set of models fordetection of malicious files, another one using another set of modelsfor detection of malicious files, a third one using several models fordetection of malicious files from the aforementioned sets of models fordetection of malicious files. The decision making templates are formedon the basis of the data obtained as to which models for detection ofmalicious files can be used to detect which malicious files.

In yet another variant aspect of the system, the analysis module 550 isadditionally designed to retrain at least one detection model from thedatabase of detection models 521 on the basis of commands and parametersselected from the behavior log of the file being executed 501 in thecase when the degree of similarity between the formed decision makingtemplate and at least one of the predetermined decision making templatesfrom the database of decision making templates 541 exceeds apredetermined threshold value, while the degrees of maliciousnesscalculated with the aid of the aforementioned models for detection of amalicious file do not exceed a predetermined threshold value.

FIG. 6 shows the structural diagram of the method for detection ofmalicious files using a trained model for detection of malicious files.

The structural diagram of the method for detection of malicious filesusing a trained model for detection of malicious files contains a step610, in which the file being analyzed is executed, a step 620, in whicha behavior log is formed, a step 630, in which behavior patterns areformed, a step 640, in which the convolution is calculated, a step 650,in which a detection model is selected, a step 660, in which the degreeof maliciousness is calculated, a step 670, in which a decision makingtemplate is formed, a step 680, in which the file is recognized asmalicious, and a step 690, in which the detection model is retrained.

In step 610, the behavior log forming module 112 is used to at least:

-   -   execute the file being analyzed 501; or    -   emulate the execution of the file being analyzed 501.

In step 620, the behavior log forming module 112 is used to form abehavior log for the file being analyzed 501, for which:

-   -   at least one command being executed is intercepted;    -   for each intercepted command at least one parameter is        determined describing that command;    -   the behavior log of said file 501 is formed on the basis of the        intercepted commands and the parameters so determined.

In step 630, the behavior log analysis module 530 is used to form atleast one behavior pattern on the basis of the commands and parametersselected from the behavior log of the file being executed 501, thebehavior pattern being a set of at least one command and a parameterwhich describes all the commands from that set.

In step 640, the behavior log analysis module 530 is used to calculatethe convolution of all the behavior patterns formed in step 630.

In step 650, the detection model selection module 520 is used to selectfrom the database of detection models 521 at least two detection modelsfor malicious files on the basis of the commands and parameters selectedfrom the behavior log of the file being executed 501, the model fordetection of malicious files being a decision making rule fordetermining the degree of maliciousness.

In step 660, the degree of maliciousness calculation module 540 is usedto calculate the degree of maliciousness of the file being executed 501on the basis of an analysis of the convolution calculated in step 640with the aid of each model for detection of malicious files selected instep 650.

In step 670, the analysis module 550 is used to form a decision makingtemplate on the basis of the degrees of maliciousness obtained in step660;

In step 680, the analysis module 550 is used to recognize the file beingexecuted 501 as malicious in the event that the degree of similaritybetween the decision making template formed in step 670 and at least oneof the predetermined decision making templates from the database ofdecision making templates 541 exceeds a predetermined threshold value.

In step 690, the analysis module 550 is used to retrain at least onedetection model from the database of detection models 521 on the basisof the commands and parameters selected from the behavior log of thefile being executed, in the event that the degree of similarity betweenthe formed decision making template and at least one of thepredetermined decision making templates from the database of decisionmaking templates 541 exceeds a predetermined threshold value, while thedegrees of maliciousness calculated with the aid of the aforementionedmodels for detection of a malicious file do not exceed a predeterminedthreshold value.

FIG. 7 shows an example of the system for detection of a malicious file.

The structural diagram of the system for detection of a malicious fileconsists of the file being analyzed 501, a file analysis module 112, adatabase of detection models 521, a data collection module 710, dataabout the behavior 711 of the file 501, a parameter calculating module720, a parameter calculation model 721, an analysis module 730, acriterion forming model 731, and a parameter correction module 740.

A more detailed description of the file analysis means 112, the file501, the database of detection models 521, and the analysis module 730(as a variant aspect of the analysis module 550) is disclosed in FIG. 1, FIG. 2 , FIG. 5 and FIG. 6 .

The data collection module 710 is designed to form, based on data aboutthe execution behavior 711 of the file 501 gathered by the file analysismodule 112, a vector of features which characterize that behavior,wherein the vector of features is a convolution of the collected data711, formed as an aggregate of numbers.

An example of the forming of the convolution of the collected data ispresented in the description of the working of the behavior patternforming module 121 in FIG. 1 .

In one variant aspect of the system, the data on the execution behavior711 of the file 501 includes at least:

-   -   the commands contained in the file being executed 501 or        interpretable in the process of execution of the file 501, the        attributes being transmitted to those commands, and the values        being returned;    -   data on the areas of RAM, which can be modified during the        execution of the file 501;    -   the static parameters of the file 501.

For example, the commands may be either instructions (or groups ofinstructions) of the computer's processor or WinAPI functions orfunctions from third-party dynamic libraries.

In yet another example, the file 501 may contain raw data which isinterpreted in the course of the execution of the file 501 as processorcommands (or commands of a certain process, as in the case of dlllibraries) and/or parameters being transferred to the commands. In aparticular case, such data can be portable code.

In yet another example, the data of RAM areas may be:

-   -   the convolutions of those memory areas (for example, using fuzzy        hashes);    -   the results of lexical analysis of those memory areas, on the        basis of which lexemes are extracted from the memory area and        statistics are gathered on their use (for example, the frequency        of use, the weighting characteristics, relations to other        lexemes, and so on);    -   static parameters of those memory areas, such as size, owner        (process), rights of use, and so forth.

The static parameters of the file 501 are parameters which characterizethe file (identify it) and which remain unchanged in the course of theexecution, the analysis, or the modification of that file 501, or whichcharacterize the file 501 up to the time of its execution.

In a particular instance, the static parameters of the file 501 maycontain information about the characteristics of its execution orbehavior (i.e. making it possible to predict of the result of theexecution of the file 501).

In yet another example, the static parameters of the file are the sizeof the file, the time of its creation or modification, the owner of thefile, the source from which the file was obtained (electronic or IPaddress), and so forth.

In yet another variant aspect of the system, data on the executionbehavior 711 of the file 501 is gathered from various sources (inputdata channels), including at least:

-   -   the log of commands executed by the file being analyzed 501;    -   the log of commands executed by the operating system or        applications being executed under the control of the operating        system (except for the file being analyzed 501);    -   data obtained through the computer network.

The parameter calculation module 720 is designed to calculate, on thebasis of the feature vector formed by the data collection module 710 andusing the trained parameter calculation model 711, the degree ofmaliciousness, being a numerical value characterizing the probabilitythat the file 501 may prove to be malicious, and the limit degree ofsafety, being a numerical value characterizing the probability that thefile 501 will definitely be safe when predetermined conditions are metwhich depend on the degree of maliciousness and the limit degree ofsafety (see FIG. 9 ), the collection of said degrees calculated insuccession being described by a predetermined time law.

In one variant aspect of the system, for each channel of input data(source of input data or data from a source of output data filtered by apredetermined criterion) a system is created for extraction of features(of a vector of real numbers of length N):

-   -   if the given channel involves the consecutive obtaining of        information (for example, a log or sequence of unpacked file        being executed), then a system is additionally created for        aggregation of the features for the input sequence into a single        vector;    -   a system is created to transform the features from the given        channel into a new vector of length K. Furthermore, the values        in this vector may only increase monotonically as new elements        of the input sequence are processed.

In yet another variant aspect of the system, the system for extraction,aggregation and transforming of features may depend on parameters fortraining, which will be attuned later on in the step of training theentire model:

-   -   vectors of length K, arriving from all active channels, are        monotonically aggregated into 1 vector of fixed length (for        example, the maximum is taken element by element);    -   the aggregated monotonically increasing vector is transformed        into 1 real number, characterizing the suspicious nature of the        process being investigated (for example, the vector is        transformed by addition of elements of that vector or by        performing actions on the elements of the vector according to a        predetermined algorithm, such as by calculating the norm of that        vector).

In yet another variant aspect of the system, the parameter calculationmodel 721 has been previously trained by the method of machine learningon at least one safe file and one malicious file.

In yet another variant aspect of the system, the method of machinelearning by the model for calculation of parameters 721 is at least themethod of:

-   -   gradient boosting on decision-making trees;    -   decision-making trees;    -   k-nearest neighbors;    -   support vectors.

In yet another variant aspect of the system, at least the degree ofmaliciousness or limit degree of safety being calculated dependrespectively on the degree of maliciousness and limit degree of safetycalculated at the time of launching of the file 501 on the basis of ananalysis of the static data of the file 501.

For example, the degree of maliciousness and the limit degree of safetymay be calculated by the formulas:ω=ω₀+ω(t)φ=φ₀+φ(t)where

-   -   ω, φ are the degree of maliciousness and the limit degree of        safety, respectively,    -   ω₀, φ₀ are the starting values of the degree of maliciousness        and the limit degree of safety not depending on the execution        parameters of the file 501, but depending on external conditions        (the working parameters of the operating system and so forth),    -   ω(t), φ(t) are the time laws used to calculate the degree of        maliciousness and the limit degree of safety, respectively.

Furthermore, said time laws may be dependent on each other, i.e. on thepreviously calculated degree of maliciousness and limit degree ofsafety:ω(t _(n))=ω(t,φ(t _(n−1)))φ(t _(n))=φ(t,ω(t _(n−1)))

The above-described variant aspect of the system is disclosed in moredetail in FIG. 9 .

In yet another variant aspect of the system, the trained parametercalculation model 721 is a collection of rules for calculating thedegree of maliciousness of the file and the limit degree of safety ofthe file, which depend on the data found about the execution behavior711 of the file 501.

In yet another variant aspect of the system, the time laws describingthe group of consecutively calculated degrees of maliciousness and thegroup of consecutively calculated limit degrees of safety are monotonicin nature.

For example, the curve of the degree of maliciousness as a function oftime may be described by a monotonically increasing function (such asƒ(x)=ax+b).

In yet another variant aspect of the system, the time laws describingthe group of consecutively calculated degrees of maliciousness and thegroup of consecutively calculated limit degrees of safety have apiecewise monotonic nature, i.e. they have a monotonic nature inspecified time intervals.

Often during the working of the system being described it is notpossible (due to limitations on the computing resources, the computertime, the demands on minimal performance, etc.) to determine constantly(continuously or with a given periodicity) the degree of maliciousness,and therefore the degree of maliciousness and the limit degree of safetymay be calculated on calculable intervals of time (not predeterminedones, but which can be calculated in the process of execution of thefile 501). Such calculations are also based on certain predeterminedtime laws, for which the input parameters are calculated in the processof execution of the file, i.e. it is possible to write for the time ofcalculation of the file:t _(n)=τ(t _(n−1))

Furthermore, the time of calculation of the degree of maliciousness andthe limit degree of safety may depend on the previously calculateddegree of maliciousness and the limit degree of safety:t _(n)=τ(t _(n−1),ω(t _(n−1)),φ(t _(n−1)))

For example, when the file 501 is launched, for the first 10 seconds thedegree of maliciousness of that file increases monotonically; after the10th second, the degree of maliciousness of that file is cut in half,and then it begins to increase monotonically once again.

The analysis module 730 is designed to make a decision on the detectionof a malicious file 501 in the event that the data collected on theexecution behavior 711 of the file 501 meets a predetermined criterionfor the determination of maliciousness, formulated on the basis of thedegree of maliciousness and the limit degree of safety as calculated bythe parameter calculation module 720, wherein that criterion is a rulefor the classification of the file (provided by the criterion formingmodel 731) in terms of an established correlation between the degree ofmaliciousness and the limit degree of safety.

In one variant aspect of the system, the correlation between the degreeof maliciousness and the limit degree of safety is at least:

-   -   the difference from a predetermined threshold value of the        distance between the degree of maliciousness and the boundary        conditions of maliciousness;    -   the difference from a predetermined threshold value of the areas        bounded in a given time interval between curves describing the        degree of maliciousness and the limit degree of safety;    -   the difference from a predetermined value of the rate of mutual        increase of the curve describing the degree of maliciousness and        the boundary conditions of maliciousness as a function of time.

For example, the most characteristic instances of the describedcorrelation are depicted in FIG. 9 .

The parameter correction module 740 is designed to retrain the parametercalculation model 721 on the basis of an analysis (see FIG. 9 ) of thecalculated degree of maliciousness and limit degree of safety, as aresult of which changes in the time laws describing the degree ofmaliciousness and the limit degree of safety cause the correlationbetween the values obtained on the basis of those time laws tend towarda maximum.

In one variant aspect of the system, the parameter calculation model 721is retrained so that, when the model is used, the criterion formedafterwards ensures at least:

-   -   that the accuracy of determining the degree of maliciousness and        the limit degree of safety is greater than when using an        untrained parameters calculation model;    -   the utilization of the computing resources is lower than when        using an untrained parameter calculation model.

For example, after the retraining (or further training), the correlationfactor between the values of the curves of the degree of maliciousnessand the limit degree of safety becomes larger (tending toward 1).

As a result, under constant retraining of the parameter calculationmodel 721 the probability of occurrence of errors of the first andsecond kind (false positives) constantly diminishes. Furthermore, theuse of the various retraining criteria presented above ensures that thesystem for detection of a malicious file with a retrained model 721 hasa very high rate of decrease in the errors of the first and second kindat the start (in the initial stages of the retraining), so that with fewretraining iterations of the parameter calculation model 721 theeffectiveness of the system for detection of a malicious file increasessharply, tending toward 100%.

FIG. 8 shows an example of the method for detection of a malicious file.

The structural diagram of the method for detection of a malicious filecontains a step 810, in which the feature vector is formed, a step 820,in which the parameters are calculated, a step 830, in which a decisionis made as to the detection of a malicious file, and a step 840, inwhich the parameter calculation model.

In step 810, a vector of the features characterizing the executionbehavior of the file is formed on the basis of the data gathered aboutthe execution behavior 711 of the file 501, the feature vector being aconvolution of the gathered data in the form of an aggregate of numbers.

In step 820, on the basis of the feature vector so formed and using thetrained parameter calculation model 721, the degree of maliciousness,being a numerical value characterizing the probability that the file 501may prove to be malicious, and the limit degree of safety, being anumerical value characterizing the probability that the file 501 willdefinitely prove to be malicious, are calculated, wherein the group ofsaid consecutively calculated degrees is described by a predeterminedtime law.

Steps 810-820 are carried out for different consecutive time intervalsof execution of the file being analyzed 501.

In step 830, a decision is made as to the detection of a malicious file501 in the event that the data gathered on the execution behavior 711 ofthe file 501 satisfies a predetermined criterion for determination ofmaliciousness (see FIG. 9 ), formulated on the basis of the degree ofmaliciousness and the limit degree of safety as calculated in step 820,said criterion being a rule for classification of the file according toan established correlation between the degree of maliciousness and thelimit degree of safety.

In step 840, the parameter calculation model 721 is additionallyretrained on the basis of an analysis of the calculated degree ofmaliciousness and limit degree of safety, as a result of which changesin the time laws describing the degree of maliciousness and the limitdegree of safety result in the correlation between the values obtainedon the basis of those laws tending toward a maximum.

FIG. 9 shows examples of the dynamics of change in the degree ofmaliciousness and the limit degree of safety as a function of the numberof behavior patterns:

In diagram 911 a situation is illustrated in which an increase in thedegree of maliciousness of the file being analyzed 501 is observed overtime (essentially as the number of behavior patterns formulatedincreases). Furthermore, an increase is likewise observed in the limitdegree of safety (the general case of the criterion of maliciousnessshown in FIG. 3 ).

A decision as to the detection of a malicious file 501 is made if thedegree of the malicious file 501 begins to exceed the limit degree ofsafety of the file 501 (point 911.B).

Such a situation is observed in the event that “suspicious” activity isregistered both during the execution of the file 501 and upon analysisof the condition of the operating system as a whole. Thus, a decrease inthe probability of occurrence of an error of the first kind is achieved.Even though suspicious activity is registered in the working of thesystem (i.e. activity not yet able to be considered malicious, but alsoalready not able to be considered safe, for example, archive packingwith subsequent deletion of the initial files), that activity isconsidered when calculating the degree of maliciousness of the file 501in such a way that the giving of a positive verdict as to the detectionof a malicious file is not based for the most part on the suspiciousactivity in the working of the system rather than during the executionof the file 501, i.e. the contribution of the execution activity of thefile 501 to the final decision on recognizing the file 501 as maliciousshould be greater than the contribution of the system activity.

For example, a similar situation may be observed when a user performs anarchiving of data on the computer, resulting in a repeated reading ofdata from the hard disk and subsequent renaming or deletion of files,which might be considered suspicious activity of the working ofmalicious encryption programs for the system of an ordinary user (suchas an office worker), since such activity (based on statistical dataobtained from users) is observed very seldom if at all for those users.

For example, a standard antivirus application may during the analysis ofthe activity of software on a user's computer issue warnings (notundertaking any active measures) that a particular application isbehaving “suspiciously”, i.e. the behavior of that application does notconform to predetermined rules of the antivirus application. But thedescribed system does not operate by predetermined rules, and insteaddynamically assesses the change in activity, resulting for a malicious,yet unknown file 501 in recognition detection (as malicious).

In yet another example, the change in activity upon execution of a file501 may be a consequence of the transmission of data in a computernetwork, depending on the characteristics of the data being transmitted(frequency, quantity, and so forth), which may indicate that maliciousactivity is taking place (for example, a remote administration(backdoor) malicious program is running). The longer such activity goeson, the higher the chance of it being recognized as malicious, since itdiffers noticeably from typical network activity on the user's computer.

In diagram 912 a situation is depicted in which an increase in thedegree of maliciousness of the file being analyzed 501 and a decrease inthe limit degree of safety is observed over time.

The decision as to the detection of a malicious file 501 is made if thedegree of the malicious file 501 begins to exceed the limit degree ofsafety of the file 501 (point 912.B).

Such a situation is observed in the event, which is the converse of thatdescribed in diagram 911, that no “suspicious” activity is observedduring the analysis of the condition of the operating system. Thus, adecrease is achieved in the probability of occurrence of an error of thesecond kind (overlooking a malicious file). Suspicious activityinfluences the giving of an affirmative verdict as to the detection of amalicious file “more strongly” if the rest of the behavior during theexecution of the file in particular or the operating system as a wholedoes not look “suspicious”.

For example, such a situation may be observed during the working ofremote administration malicious programs on the user's computer, as aresult of which programs the malicious activity appears onlyepisodically, that is, every subsequent episode should be analyzed more“closely”, i.e. the criterion after which the activity will beconsidered malicious should decrease constantly. But in the event thattrusted applications begin being executed on the user's computer, thebehavior of which might be considered suspicious but is not consideredsuch on account of the applications being trusted (i.e. previouslychecked for maliciousness), then the limit degree of maliciousness maybe increased, which will protect against recognizing the behavior oflegitimate files as malicious and merely postpone the detecting ofmalicious behavior of a malicious file.

In diagram 913 a situation is depicted in which an increase in thedegree of maliciousness of the file being analyzed 501 is observed overtime, the increase starting not from the zero mark, but rather from acertain calculated value, so that the criterion of maliciousness will bereached earlier than in the initial case, or it will be reached whereasit would not have been reached in the initial case.

The decision on the detection of a malicious file 501 is made if thedifference between the degree of the malicious file 501 and the limitdegree of safety of the file 501 becomes less than a predeterminedthreshold value (point 913.B). Furthermore, in a particular instance,such a decision can be made only if the difference between the degree ofthe malicious file 501 and the limit degree of safety of the file 501was previously becoming less than another predetermined threshold value(point 913.A) (wherein this difference between points 913A and 913B wasable to increase).

For example, during the execution of a file 501 obtained from an unknownsource or formed on the computer by “suspicious” methods (such as awriting of data from the memory of a process to disk), the degree ofmaliciousness may initially be higher than the degree of maliciousnessof files obtained by less “suspicious” methods.

In the diagram 914 a situation is illustrated which is analogous to thesituation depicted in diagram 911, with the only difference being thatthe curves describing the degree of maliciousness and the limit degreeof safety have several successive points of intersection. In such asituation, the decision to recognize the file 501 as malicious is madenot because of the fact of the intersection of these curves, but becauseof the exceeding of a predetermined threshold value by the number ofintersections or because of the exceeding of a predetermined thresholdvalue by the area cut out by these curves.

These diagrams help to increase the effectiveness of detection ofmalicious files and reduce the errors of the first and second kind inthe detection of malicious files 501.

The description of the correlation between the calculated degree ofmaliciousness and limit degree of safety and the decision on recognizingthe file 501 as malicious can be expressed in the following mathematicalor algorithmic form:

ω(t) > φ(t)${\sum\limits_{n}\left( {{\omega\left( t_{n} \right)} > {\varphi\left( t_{n} \right)}} \right)^{2}} > ɛ$

FIG. 4 is a block diagram illustrating a computer system 20 on whichaspects of systems and methods for post-route analysis of an autonomousvehicle may be implemented in accordance with an exemplary aspect. Itshould be noted that the computer system 20 can correspond to theanalysis module 140, or other components of system 100, for example,described earlier.

As shown, the computer system 20 (which may be a personal computer or aserver) includes a central processing unit 21, a system memory 22, and asystem bus 23 connecting the various system components, including thememory associated with the central processing unit 21. As will beappreciated by those of ordinary skill in the art, the system bus 23 maycomprise a bus memory or bus memory controller, a peripheral bus, and alocal bus that is able to interact with any other bus architecture. Thesystem memory may include permanent memory (ROM) 24 and random-accessmemory (RAM) 25. The basic input/output system (BIOS) 26 may store thebasic procedures for transfer of information between elements of thecomputer system 20, such as those at the time of loading the operatingsystem with the use of the ROM 24.

The computer system 20 may also comprise a hard disk 27 for reading andwriting data, a magnetic disk drive 28 for reading and writing onremovable magnetic disks 29, and an optical drive 30 for reading andwriting removable optical disks 31, such as CD-ROM, DVD-ROM and otheroptical media. The hard disk 27, the magnetic disk drive 28, and theoptical drive 30 are connected to the system bus 23 across the hard diskinterface 32, the magnetic disk interface 33, and the optical driveinterface 34, respectively. The drives and the corresponding computerinformation media are power-independent modules for storage of computerinstructions, data structures, program modules, and other data of thecomputer system 20.

An exemplary aspect comprises a system that uses a hard disk 27, aremovable magnetic disk 29 and a removable optical disk 31 connected tothe system bus 23 via the controller 55. It will be understood by thoseof ordinary skill in the art that any type of media 56 that is able tostore data in a form readable by a computer (solid state drives, flashmemory cards, digital disks, random-access memory (RAM) and so on) mayalso be utilized.

The computer system 20 has a file system 36, in which the operatingsystem 35 may be stored, as well as additional program applications 37,other program modules 38, and program data 39. A user of the computersystem 20 may enter commands and information using keyboard 40, mouse42, or any other input device known to those of ordinary skill in theart, such as, but not limited to, a microphone, joystick, gamecontroller, scanner, etc. Such input devices typically plug into thecomputer system 20 through a serial port 46, which in turn is connectedto the system bus, but those of ordinary skill in the art willappreciate that input devices may be also be connected in other ways,such as, without limitation, via a parallel port, a game port, or auniversal serial bus (USB). A monitor 47 or other type of display devicemay also be connected to the system bus 23 across an interface, such asa video adapter 48. In addition to the monitor 47, the personal computermay be equipped with other peripheral output devices (not shown), suchas loudspeakers, a printer, etc.

Computer system 20 may operate in a network environment, using a networkconnection to one or more remote computers 49. The remote computer (orcomputers) 49 may be local computer workstations or servers comprisingmost or all of the aforementioned elements in describing the nature of acomputer system 20. Other devices may also be present in the computernetwork, such as, but not limited to, routers, network stations, peerdevices or other network nodes.

Network connections can form a local-area computer network (LAN) 50 anda wide-area computer network (WAN). Such networks are used in corporatecomputer networks and internal company networks, and they generally haveaccess to the Internet. In LAN or WAN networks, the personal computer 20is connected to the local-area network 50 across a network adapter ornetwork interface 51. When networks are used, the computer system 20 mayemploy a modem 54 or other modules well known to those of ordinary skillin the art that enable communications with a wide-area computer networksuch as the Internet. The modem 54, which may be an internal or externaldevice, may be connected to the system bus 23 by a serial port 46. Itwill be appreciated by those of ordinary skill in the art that saidnetwork connections are non-limiting examples of numerouswell-understood ways of establishing a connection by one computer toanother using communication modules.

In various aspects, the systems and methods described herein may beimplemented in hardware, software, firmware, or any combination thereof.If implemented in software, the methods may be stored as one or moreinstructions or code on a non-transitory computer-readable medium.Computer-readable medium includes data storage. By way of example, andnot limitation, such computer-readable medium can comprise RAM, ROM,EEPROM, CD-ROM, Flash memory or other types of electric, magnetic, oroptical storage medium, or any other medium that can be used to carry orstore desired program code in the form of instructions or datastructures and that can be accessed by a processor of a general purposecomputer.

In various aspects, the systems and methods described in the presentdisclosure can be addressed in terms of modules. The term “module” asused herein refers to a real-world device, component, or arrangement ofcomponents implemented using hardware, such as by an applicationspecific integrated circuit (ASIC) or field-programmable gate array(FPGA), for example, or as a combination of hardware and software, suchas by a microprocessor system and a set of instructions to implement themodule's functionality, which (while being executed) transform themicroprocessor system into a special-purpose device. A module may alsobe implemented as a combination of the two, with certain functionsfacilitated by hardware alone, and other functions facilitated by acombination of hardware and software. In certain implementations, atleast a portion, and in some cases, all, of a module may be executed onthe processor of a general purpose computer (such as the one describedin greater detail in FIG. 4 , above). Accordingly, each module may berealized in a variety of suitable configurations, and should not belimited to any particular implementation exemplified herein.

In addition, the terms “first,” “second,” etc. are typically used hereinto denote different units (e.g., a first element, a second element). Theuse of these terms herein does not necessarily connote an ordering suchas one unit or event occurring or coming before another, but ratherprovides a mechanism to distinguish between particular units.Additionally, the use of a singular tense of a noun is non-limiting,with its use typically including one or more of the particular thingrather than just one (e.g., the use of the word “memory” typicallyrefers to one or more memories without having to specify “memory ormemories,” or “one or more memories” or “at least one memory”, etc.).Moreover, the phrases “based on x” and “in response to x” are used toindicate a minimum set of items x from which something is derived orcaused, wherein “x” is extensible and does not necessarily describe acomplete list of items on which the operation is performed, etc.

In the interest of clarity, not all of the routine features of theaspects are disclosed herein. It would be appreciated that in thedevelopment of any actual implementation of the present disclosure,numerous implementation-specific decisions must be made in order toachieve the developer's specific goals, and these specific goals willvary for different implementations and different developers. It isunderstood that such a development effort might be complex andtime-consuming, but would nevertheless be a routine undertaking ofengineering for those of ordinary skill in the art, having the benefitof this disclosure.

Furthermore, it is to be understood that the phraseology or terminologyused herein is for the purpose of description and not of restriction,such that the terminology or phraseology of the present specification isto be interpreted by the skilled in the art in light of the teachingsand guidance presented herein, in combination with the knowledge ofthose skilled in the relevant art(s). Moreover, it is not intended forany term in the specification or claims to be ascribed an uncommon orspecial meaning unless explicitly set forth as such.

The various aspects disclosed herein encompass present and future knownequivalents to the known modules referred to herein by way ofillustration. Moreover, while aspects and applications have been shownand described, it would be apparent to those skilled in the art havingthe benefit of this disclosure that many more modifications thanmentioned above are possible without departing from the inventiveconcepts disclosed herein.

What is claimed is:
 1. A method for machine learning by a model fordetection of malicious files, comprising: selecting a plurality of knownsafe files and known malicious files from a database of files used toperform training of a model for detecting a malicious file, whereinselecting of the files is based on predetermined rules of forming atraining selection of files, wherein the predetermined rules specify atleast ratios of selected safe and malicious files; executing by aprocessor the plurality of selected files; forming one or more behaviorpatterns from intercepted one or more commands and parameters duringexecution of the selected files; forming a detection model, wherein thedetection model selects a method of machine learning and is initializedwith one or more hyper-parameters; training the detection model bycalculating the one or more hyper-parameters based on the one or morebehavior patterns to form a group of rules for calculating a degree ofmaliciousness of a resource; and calculating a degree of maliciousnessof another file based on the trained detection model.
 2. The method ofclaim 1, wherein the predetermined rules of forming a training selectionof files further specify numbers of selected safe and malicious filesselected from the database of files for training of the model.
 3. Themethod of claim 1, wherein the database of files is a database of safefiles comprising one or more of operating system files, backdoor files,applications carrying out unauthorized data access.
 4. The method ofclaim 1, wherein the distribution between safe and malicious filesselected from the database of files corresponds to the distributionbetween safe and malicious files located on the computing device of theaverage user.
 5. The method of claim 1, wherein the distribution betweensafe and malicious files selected from the database of files correspondsto the distribution between safe and malicious files collected with thehelp of antivirus web crawlers.
 6. The method of claim 1, wherein atleast one of the parameters of the files selected from the database offiles correspond to the parameters of the files located on the computingdevice of the average user or the number of selected files correspondsto a predetermined value, while the files themselves are selected atrandom.
 7. The method of claim 1, wherein training further comprises:selecting at least one more file from the database of files inaccordance with predetermined rules of forming a test selection offiles; verifying the trained detection model on the basis of an analysisof the selected files; and sending the selected files to form a behaviorlog.
 8. The method of claim 7, further comprising: interceptingexecutable commands; determining parameters associated with each of theexecutable commands that were intercepted; forming the behavior logbased on the parameters.
 9. The method of claim 8, wherein interceptingis performed using one of a specialized driver, a debugger and ahypervisor.
 10. The method of claim 1, wherein the method for machinelearning is selected based on one or more of cross testing, slidingcheck, cross-validation, mathematical validation, A/B testing, splittesting and stacking.
 11. The method of claim 1, further comprising:creating the detection model on demand based on machine learning,wherein the hyper parameters and methods of machine learning areselected to be different from the hyper parameters and machine learningmethods chosen for a previous detection model.
 12. The method of claim1, wherein the method for machine learning is selected to ensure amonotonic change in the degree of maliciousness of a file depending onthe change in the number of behavior patterns formed on the basis ofanalysis of a behavior log.
 13. A system for machine learning by a modelfor detection of malicious files, comprising: a hardware processor,configured to: select a plurality of known safe files and knownmalicious files from a database of files used to perform training of amodel for detecting a malicious file based on predetermined rules offorming a training selection of files, wherein the hardware processorconfigured to select the files is configured to select the files basedon predetermined rules of forming a training selection of files, whereinthe predetermined rules specify at least ratios of selected safe andmalicious files; execute the plurality of selected files; form one ormore behavior patterns from intercepted one or more commands andparameters during execution of the selected files; form a detectionmodel, wherein the detection model selects a method of machine learningand is initialized with one or more hyper-parameters; train thedetection model by calculating the one or more hyper-parameters based onthe one or more behavior patterns to form a group of rules forcalculating a degree of maliciousness of a resource; and calculatedegree of maliciousness of another file based on the trained detectionmodel.
 14. The system of claim 13, wherein the predetermined rules offorming a training selection of files further specify numbers ofselected safe and malicious files selected from the database of filesfor training of the model.
 15. The method of claim 13, wherein thedatabase of files is a database of safe files comprising one or more ofoperating system files, backdoor files, applications carrying outunauthorized data access.
 16. The method of claim 13, wherein thedistribution between safe and malicious files selected from the databaseof files corresponds to the distribution between safe and maliciousfiles located on the computing device of the average user.
 17. Themethod of claim 13, wherein the distribution between safe and maliciousfiles selected from the database of files corresponds to thedistribution between safe and malicious files collected with the help ofantivirus web crawlers.
 18. The method of claim 13, wherein at least oneof the parameters of the files selected from the database of filescorrespond to the parameters of the files located on the computingdevice of the average user or the number of selected files correspondsto a predetermined value, while the files themselves are selected atrandom.
 19. The method of claim 13, wherein training further comprises:selecting at least one more file from the database of files inaccordance with predetermined rules of forming a test selection offiles; verifying the trained detection model on the basis of an analysisof the selected files; and sending the selected files to form a behaviorlog.
 20. A non-transitory computer-readable medium, storing instructionsthereon for machine learning by a model for detection of maliciousfiles, the instructions comprising: selecting a plurality of known safefiles and known malicious files from a database of files used to performtraining of a model for detecting a malicious file, wherein selecting ofthe files is based on predetermined rules of forming a trainingselection of files, wherein the predetermined rules specify at leastratios of selected safe and malicious files; executing by a processorthe plurality of selected files; forming one or more behavior patternsfrom intercepted one or more commands and parameters during execution ofthe selected files; forming a detection model, wherein the detectionmodel selects a method of machine learning and is initialized with oneor more hyper-parameters; training the detection model by calculatingthe one or more hyper-parameters based on the one or more behaviorpatterns to form a group of rules for calculating a degree ofmaliciousness of a resource; and calculating a degree of maliciousnessof another file based on the trained detection model.